How to insert widget into QTableView's viewport?
-
Is there a way to insert a widget at the bottom of a table, below the last row but above the horizontal scroll bar?
Edit: If there's no way to do this, is there a way to make a QTableView automatically resize it's height to fit it's contents? I can nest the QTableView with the widget I want at the bottom, inside of a QScrollArea.
-
Is there a way to insert a widget at the bottom of a table, below the last row but above the horizontal scroll bar?
Edit: If there's no way to do this, is there a way to make a QTableView automatically resize it's height to fit it's contents? I can nest the QTableView with the widget I want at the bottom, inside of a QScrollArea.
@Qt_User72653 said in How to insert widget into QTableView's viewport?:
is there a way to make a QTableView automatically resize it's height to fit it's contents? I can nest the QTableView with the widget I want at the bottom, inside of a QScrollArea.
I think this is indeed the way to go. you can call
QTableView::setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents)
to make it automatically resize -
The AdjustToContents flag doesn't seem to be doing anything. I can set a fixed height for the embedded table, which works, but then I'd have to reset the table size every time data is added.
-
The AdjustToContents flag doesn't seem to be doing anything. I can set a fixed height for the embedded table, which works, but then I'd have to reset the table size every time data is added.
@Qt_User72653 said in How to insert widget into QTableView's viewport?:
The AdjustToContents flag doesn't seem to be doing anything
I doubt it. I use this extensively. can you show your code
-
Not at the moment, I'm in the middle of trying to convert the old table to the new nested table, so I'm still not completely sure what's relevant or not.
I do wonder, though, if the container scroll area is forcing a size contraint on the embedded table.