My objective is to develop the application using modular approach.
Using QtDesigner I build EMPTY MainWindow , then using same method I build another blank, EMPTY class.
In this example QMdiArea.
Next step is to populate QMdiArea class / form as desired.
Next step is to ADD the QMdiArea class to MainWindow - so it became itergral part of MainWindow, no loger idependelty floating.
I found this snippet of code which supposedly works, but I am getting runtime error
and my QMdiArea widget is stiil afloat, pretty much out of control of main window.
// create layout
// Set layout
this->setLayout(layout);
// add mdi area class
MdiArea *mdiarea = new MdiArea();
mdiarea->show();
// add to main window
layout->addWidget(mdiarea);
mdiarea->show();
// create layout
// Set layout
QHBoxLayout *layout = new QHBoxLayout;
this->setLayout(layout);
// add mdi area class
MdiArea *mdiarea = new MdiArea();
mdiarea->show();
// add to main window
layout->addWidget(mdiarea);
mdiarea->show();
To copy to clipboard, switch view to plain text mode
Here is the error
Starting /media/z/DEV_COPY_LABEL/Qt/QT/qtconnectivity/examples/bluetooth/build-CAT_BT-Desktop-Debug/btscanner...
QWidget::setLayout: Attempting to set QLayout "" on MainWindow_BT_MDI "MainWindow_BT_MDI", which already has a layout
OK, main window has "layout" - so how do I physically use it to add my QMdiArea class ?
PS
There seems to be standard method to add "QDock" to main window , but I have not tried it, not yet - next task.
Bookmarks