PDA

View Full Version : How to adjust the a QHeaderView's width



culgi
31st January 2008, 07:42
I used a QTableWidget in my program, there was also a vertical header, after starting the program's run, when i clicked the vertical header, i want to add a QtableWidgetItem to the vertical header using "serVerticalHeaderItem( logicalIndex, pItem)", but the width of the vertical header doesn't adjust to display the whole icon image, how can i make this working better?

code:

QTableWidgetItem* pItem = new QTableWidgetItem(QIcon(tr(":/Images/breakpoint.png")), tr(""));

setVerticalHeaderItem( argLogicalIndex, pItem );


ps: i tryed resizeSecton(), but it doesn't work!
resizeSection works correctly for the horizontalHeader(), but it resizes the height instead of the width in the verticalHeader()

marcel
31st January 2008, 07:54
You could try verticalHeaderItem()->setSizeHint(pixmapSize);

culgi
31st January 2008, 08:35
Thank you, it does work^_^