如何使Qt的BorderLayout项目可调整大小?

时间:2014-05-29 13:48:11

标签: c++ qt user-interface layout

我尝试使用类似于Qt BorderLayout example的布局创建应用程序,并且我将其用作模板。如何通过像QSplitter一样在它们之间的边框上拖动鼠标来使区域可以调整大小?

1 个答案:

答案 0 :(得分:0)

我设法在不使用BorderLayout的情况下解决了问题:

QTextBrowser *centralWidget = new QTextBrowser;
centralWidget->setPlainText(tr("Central widget"));

QLabel* west = createLabel( "West" );
QLabel* east = createLabel( "East" );
QLabel* south = createLabel( "South" );

QSplitter* splitter = new QSplitter();

splitter->addWidget(west);
splitter->addWidget(centralWidget);
splitter->addWidget(east);

QSplitter* splitter2 = new QSplitter( Qt::Orientation::Vertical );
splitter2->addWidget( splitter );
splitter2->addWidget( south );