PDA

View Full Version : QTableView column-headers too short ...



kerim
19th April 2011, 14:30
hi,

i am using a QTableView and i recognized that calling
QTableView::resizeColumnsToContents only resizes columns for rows that are visible ..
means: if i scroll my data down there are still none-resized columns !!

i tried also to set the resizeMode via QHeaderView::setResizeMode(QHeaderView::ResizeToCo ntents)

but that also seems not to work. is there any calling or possibility to
resize columns for all rows within my table and not only the visible ones!??!?

hope anybody has some idea :confused:

poporacer
19th April 2011, 15:54
You have to use:

int QTableView::sizeHintForColumn ( int column ) const
This will give you the size for the column, then put that number in for your column width.

kerim
20th April 2011, 09:09
thnx,
but how am i supposed to use that?
do i have to subclass QTableView and reimplement that?
and if so, how is my data-model connected to the tableview
because only my model knows how big the width has to be
for a certain column ??:confused: