#include#include #include // ... QSplitter *splitter = new QSplitter(Qt::Horizontal); QPushButton *button = new QPushButton("Click me"); QTextEdit *textEdit = new QTextEdit("Lorem ipsum dolor sit amet."); splitter->addWidget(button); splitter->addWidget(textEdit); // add the splitter to a layout or to the window itself
splitter->setSizes(QList() << 50 << 200);
button->setMinimumSize(50, 50); textEdit->setMinimumSize(100, 100);
splitter->setOrientation(Qt::Vertical);This changes the orientation of the splitter to be vertical instead of horizontal. These examples were written using the Qt library.