I have tested this code and it works.
this->setLayout(layout);
this->ui->setupUi(this);
// build mdi area
MdiArea *mdiarea = new MdiArea();
this->layout()->addWidget(mdiarea);
QHBoxLayout *layout = new QHBoxLayout;
this->setLayout(layout);
this->ui->setupUi(this);
// build mdi area
MdiArea *mdiarea = new MdiArea();
this->layout()->addWidget(mdiarea);
To copy to clipboard, switch view to plain text mode
Could you elaborate on differences between using
layout and using setCentralWidget( mpMdiArea );?
Would I use using both methods - one to initially add base class (setCentralWidget) and then adding more classes
using layout ?
Added after 31 minutes:
Here is the latest code
this->ui->setupUi(this);
MdiArea *mdiarea = new MdiArea();
setCentralWidget( mdiarea );
this->layout()->addWidget(mdiarea);
this->ui->setupUi(this);
MdiArea *mdiarea = new MdiArea();
setCentralWidget( mdiarea );
this->layout()->addWidget(mdiarea);
To copy to clipboard, switch view to plain text mode
Please note - setCentralWidget( mdiarea ); indieed adds QMdiArea ONLY - as entire MainWindow.
layout ACTAULLY adds the real QMdiArea class into MainWindow as desired.
However. I get run time complains...but runs.
appmenu-qt: handleReparent 143 The given QMenuBar is already registered by appmenu-qt5, skipping
QMainWindowLayout::addItem: Please use the public QMainWindow API instead
/media/z/DEV_COPY_LABEL/Qt/QT/qtconnectivity/examples/bluetooth/build-CAT_BT-Desktop-Debug/btscanner exited with code 0
Bookmarks