PDA

View Full Version : QTableView ::setColumnWidth not working?



killerwookie99
1st November 2008, 23: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, 07:13
Hi!

Have you set the:

tableView->setColumnCount(3);

in your code?

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