In my TableModel I've two columns. This model is connected to the TableView. How can I set them up so those two columns fill the tableView so there is no free space?
EDIT:
Asked
Active
Viewed 2,390 times
7

HostileFork says dont trust SE
- 32,904
- 11
- 98
- 167

user336635
- 2,081
- 6
- 24
- 30
-
[Auto-resize columns to fit parent](http://stackoverflow.com/a/34190094) – frogatto Dec 09 '15 at 22:23
1 Answers
9
Try this:
tableView->horizontalHeader()->setStretchLastSection(true);
tableView->resizeColumnsToContents(); // not necessarily but can make look better

Andrey Atapin
- 7,745
- 3
- 28
- 34
-
-
-
I've dragged it from qt's Item Views section/Model based on my dialog. – user336635 Dec 13 '11 at 11:31
-
-