PDA

View Full Version : QTableWidget Default width of row and column



sagirahmed
8th October 2010, 12:06
Hi,

I am using QtableWidget and want to set the default width of row and column. So that every time new row is added and there is no need to set the width.

Thanks & Regards

gboelter
8th October 2010, 12:10
Are you looking for something like this:



tableWidget->setColumnWidth( 0, 160 );
tableWidget->setColumnWidth( 1, 100 );

sagirahmed
8th October 2010, 12:28
Hi,

Thanks for reply but i need this

table->horizontalHeader()->resizeSection(column,10);
table->verticalHeader()->resizeSection(row,10);

column and row need to passed only once. I don't want to set again and again

gboelter
8th October 2010, 12:41
Put the code I have posted above into the header (once for each column). No need to do it again and again ...

But may be this is what you are really looking for:



tableWidget->verticalHeader()->setDefaultSectionSize(50);
tableWidget->horizontalHeader()->setDefaultSectionSize(200);

sagirahmed
11th October 2010, 05:01
Hi,

Thanks It works as I want