PDA

View Full Version : QTabletWidget - Define a fix column width



ape
10th March 2008, 15:37
Hello,

wondering if its possible ( basically i think so) to define a fix column width in my QTablewidget.

Example code:


// Table which displays informations about this computer
tableWidget = new QTableWidget(this);
tableWidget->setRowCount(5);
tableWidget->setColumnCount(1);
tableWidget->setShowGrid(true); // show Grid
tableWidget->setWindowModality(Qt::ApplicationModal); //tableWidget->setSizePolicy(Expanding, Expanding, 0,0);
tableWidget->setSortingEnabled(false);
tableWidget->setCornerButtonEnabled(true);


I would like to be able to define the width of both columns i am using right now.
Would be great if you could help me locating the correct keyword for the Qt docs.
My search for size, width etc was not successfull unfortunaly

Best regards
ape

ape
11th March 2008, 11:45
its not the best solution, but enough for my case:


tabletWidget->horizontalHeader()->setStretchLastSection(true);

THRESHE
11th March 2008, 14:30
I did it like this


tableWidget->horizontalHeader()->setResizeMode(8, QHeaderView::Fixed);