PDA

View Full Version : headerless QTableView with one cell thinks it's much bigger



cboles
8th May 2006, 23:26
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?

wysota
8th May 2006, 23:34
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?

cboles
10th May 2006, 03:14
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

http://openecu.org/images/5/50/EcuFlash_Screenshot.png