you creates QStandardItemModel model(5, 2); in a stack (an object will be destroyed when out of scope). you should create in the heap, i.e. QStandardItemModel *model = new QStandardItemModel(5, 2);.
you creates QStandardItemModel model(5, 2); in a stack (an object will be destroyed when out of scope). you should create in the heap, i.e. QStandardItemModel *model = new QStandardItemModel(5, 2);.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
ahh ty, cause the book used it in the main function. Thanks for your expertise![]()
After successfully implementing the QTableView, how do i make it stretch fully? As there are gaps on the right and bottom.
im not sure if im allowed to do this, bumps.
Try:
Qt Code:
To copy to clipboard, switch view to plain text mode
Thanks for the help but it doesnt seem to be working.
edit: it seems that it isnt the QTableView that is not expanding, rather it is the model that it is displaying that doesnt expand.
Last edited by junxuan; 29th July 2009 at 13:48.
You don't need line 23 in your original post.
Maybe:are more to your liking?Qt Code:
table->horizontalHeader()->setStretchLastSection(true); ORTo copy to clipboard, switch view to plain text mode
Bookmarks