Results 1 to 2 of 2

Thread: qtablewidget exposed lines

  1. #1
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default qtablewidget exposed lines

    Hi,


    I have a QTableWidget that is being resized by the user. I need it to have as many rows as fit on the screen, without creating scrollbars.


    For that i would need to calculate the number of rows exposed on the screen. I was unable to find a method for taht, so i did the following calculation:


    (height - header.height) / rowheight


    But the result is ... well, it works but it doesnt look very clean. is there a better or more official way?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qtablewidget exposed lines

    In general rows can have different heights so unless you forbid resizing them. If you put a constraint on the size, then it will be easy for you to calculate what you need.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 15th March 2014, 12:15
  2. Accessing C++ Element exposed for QML in C++
    By Rocken in forum Qt Quick
    Replies: 1
    Last Post: 22nd February 2012, 14:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.