Solved Set correct minimum height of QTableView
-
I have an instance of QTableView, I want to adjust the minimum height to show 4 rows when its displayed.
As you can see from the above pic, it doesn't show anything like 4 rows. I've tried:
QFontMetrics fntMetrics(mptvSDrecs->fontMetics()); mptvSDrecs->setMinimumHeight((mscuint16Rows + 1) * fntMetrics.height());
Where in the about mscuint16Rows is defined as
const quint16 MyClass::mscuint16Rows = 4;
And mptvSDrecs is an instance of QTableView.
However the displayed table view is just enough to display the header row and 1 data row.
-
You can get the rowHeight for every for from https://doc.qt.io/qt-5/qtableview.html#rowHeight
-
You can get the rowHeight for every for from https://doc.qt.io/qt-5/qtableview.html#rowHeight
-
@Christian-Ehrlicher , thank you, will try that now.