PDA

View Full Version : Resize Columns when QTableView is full screen and default size



nagabathula
11th April 2011, 15:03
Hello every one i have a QTableView in which i am displaying some data, I wanted to know how i can resize the Cells in the QTableView when i resize the window to full screen. right now there is white space after four columns. I wanted to resize the column size so that there is no white space seen when i see it in the Full Screen also.
I tried a few things but it din't work as expected.

tableView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

tableView->setColumnWidth(0,100);
tableView->setColumnWidth(1,100);
tableView->setColumnWidth(2,100);
tableView->setColumnWidth(3,100);
i looked on the forum but din't find much help on this issue.. What should i do to resize the columns when i view full screen.

Thank you

mak_user
11th April 2011, 16:02
void QHeaderView::setResizeMode ( int logicalIndex, ResizeMode mode )

nagabathula
11th April 2011, 17:03
hello thank you for the help.. i did this and my problem is solved .


tableView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);

regards