PDA

View Full Version : QTableView ::setColumnWidth not working?



killerwookie99
2nd November 2008, 00:32
In my code I declare a QTableView *tableView = new QTableView(), then I procede to call several functions.



tableView->verticalHeader->hide()
...
tableView->setColumnWidth(0, 15);
tableView->setColumnWidth(1, 15);
tableView->setColumnWidth(2, 15);
...

The problem is, the tableView doesn't reflect the setColumnWidth! I would think this would work with little to no effort? Do I have to populate the tableView with data first? Seems kinda silly.

kemp
2nd November 2008, 08:13
Hi!

Have you set the:

tableView->setColumnCount(3);

in your code?

killerwookie99
5th November 2008, 18:14
You do have to load the tableview before setting size. Ah well.