QTableWidget column and row sizes
Hello,
Currently I have the following question. How could I set:
- Default row height of a QTableWidget row
- Default column width of a QTableWidget column
I know you can do this by implementing sizeHint in a QItemDelegate, and use resize functions, but since I have douzens of rows and columns I want a decent default size.
On the 'old' Qt forum there was a post by someone who provided a 'patch', for the row height (defaultSectionSize method and sectionSizeFromContents), but that patch doesn't work for some reason. I cannot post on that forum anymore, so I would appreciate it if some Qt guru could tell me how to implement this.
Greets,
Arthur
Re: QTableWidget column and row sizes
Hi,
use QHeaderView::resizeSection
Re: QTableWidget column and row sizes
Thank you for your reply.
The problem is that I absolutely don't want to resize, since this is way to slow. I want to change the default size.
Arthur
Re: QTableWidget column and row sizes
resizeSection is a better way to resize hight of all your rows...
it works fast, if you use setUpdatesEnabled...
the default row height you can't set at all.
here is an example... it's wrote on Qt3, but i think it will work on Qt4 similar...
Code:
verticalHeader()->setUpdatesEnabled(FALSE);
for (unsigned int i = 0; i < numRows(); i++)
verticalHeader()->resizeSection(i, rowHeight);
verticalHeader()->setUpdatesEnabled(TRUE);
Re: QTableWidget column and row sizes
Ok thanks, that helps a lot...