Results 1 to 3 of 3

Thread: headerless QTableView with one cell thinks it's much bigger

  1. #1
    Join Date
    Mar 2006
    Posts
    46
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default headerless QTableView with one cell thinks it's much bigger

    I have a QTableView (sometimes 3 QTableViews) inside of a layout for a QWidget. The QTableView has no headers, and sometime has only a single, cell, making it quite small in that case. When the table has many cells, the widget shrinks and grows appropriately. When the table is small, the widget never gets smaller than approximately 100x70 pixels even though the cell itself is 36x16. I thought maybe this was some sort of minimum size issue with the widget or layout, but when I replace the QTableView with another widget like a QLabel, the widget is able to get smaller.

    Debugging sizing/layout is a real pain as there are some many calls made to compute the layout. It appears that the QTableView is giving out a very poor sizeHint when it is small. Perhaps it's taking the missing headers into account when it should not? Has anyone experienced / solved this problem?

  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: headerless QTableView with one cell thinks it's much bigger

    It's possible that it can't shrink more (just like QPushButton). Are you sure you need a table view if you only use a single cell?

  3. #3
    Join Date
    Mar 2006
    Posts
    46
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: headerless QTableView with one cell thinks it's much bigger

    Quote Originally Posted by wysota
    It's possible that it can't shrink more (just like QPushButton). Are you sure you need a table view if you only use a single cell?
    Each view widget has a differing number of cells - from 1x1 to ~32x32 depending on the model they represent. The widgets just look funny and waste screen real estate when I go to 1x1.

    This picture gives you and idea what the widgets look like. These widgets actually have a couple of labels and 3 QTableViews each. When you reduce these QTableViews to 1x1, they take up additional dead space outside of their single cell, making the widget bigger than it needs to be


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.