Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Qt's BorderLayout items resizable?

I'm trying to create an application with layout similar to Qt's BorderLayout example and I'm using it as a template. How can I make regions resizable by dragging mouse on the border between them like with QSplitter?

like image 374
SurvivalMachine Avatar asked Feb 22 '26 04:02

SurvivalMachine


1 Answers

I managed to solve the problem without using BorderLayout at all:

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 );
like image 192
SurvivalMachine Avatar answered Feb 24 '26 19:02

SurvivalMachine