Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Calculating the exact needed height for a QTableWidget

Calculating the exact needed height for a QTableWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 249 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • l3u_L Offline
    l3u_L Offline
    l3u_
    wrote on last edited by l3u_
    #1

    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:

    breeze.png

    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):

    fusion.png

    Is there a way to calculate the exact size independently of the style? I did not find anything fitting yet …

    Thanks for all help!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved