Calculating the exact needed height for a QTableWidget
Unsolved
General and Desktop
-
Hi :-)
I want to calculate the exact height a
QTableWidget
needs so that no vertical scroll bar is shown. What I do right now is for example:tableWidget->setMaximumHeight(tableWidget->horizontalHeader()->height() + tableWidget->rowHeight(0) * 4 + 4);
for this case, having 4 rows and KDE's Breeze style set, this works exactly:
But the additional 4 pixels seem to be style-dependent, using the Fusion style I get a bit more space than I need (cf. the last row, there are 2 unneeded white pixels):
Is there a way to calculate the exact size independently of the style? I did not find anything fitting yet …
Thanks for all help!