tags:

views:

168

answers:

1

I have a QVBoxLayout with a few widgets in it (QTableViews). Now these QTableViews all have the same size. What can I do, that the user can change the size of one QTableView on runtime (so that 1 QTableView is bigger than the other one)? Maybe with a "seperator" which you can change with the mouse?

+2  A: 

Use a QSplitter: http://doc.trolltech.com/4.6-snapshot/qsplitter.html

If you have this code:

QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(table1);
layout->addWidget(table2);
layout->addWidget(table3);
setLayout(layout);

You should be able to just change it to:

QSplitter *splitter = new QSplitter;
splitter->addWidget(table1);
splitter->addWidget(table2);
splitter->addWidget(table3);
splitter->setOrientation(Qt::Vertical);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(splitter);
setLayout(layout);
Colin
perfekt! thanks.
Berschi