Resize qwidget in layout manually at runtime

I have a QVBoxLayout with several widgets in it (QTableViews). Now these QTableViews are the same size. What can I do so that the user can resize one QTableView at runtime (so that 1 QTableView is larger than the other)? Maybe with a "seperator" that you can change with the mouse?

+4
source share
1 answer

Use QSplitter: http://doc.qt.digia.com/4.6/qsplitter.html

If you have this code:

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

You should 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); 
+6
source

Source: https://habr.com/ru/post/1299058/


All Articles