Qt-creator : Recommanded way to create a window to integrate an mdiarea [Solved]
-
I get one project A with, for the time being one form.
In this form is defined an mdiarea.
I now want to design the widgets that the mdiarea will host.How should I proceed : Add New > Qt > Qt Designer Form Class ? Qt Designer Form ?
Being said that, if possible, I'd like to make so these "sub" widgets can be launched "on their own" (as main windows) of other standalone applications, should I even prefer creating a new independent project for each one of these "sub"widgets?
I apologize for not using the exact terminology. I am completely new to qt.
-
You can create widgets at your own like "Qt Designer Form Class" and then add to a QMdiArea. The way to do this should be:
subWindowWidget = ui.mdiArea->addSubWindow(treeView,Qt::Widget);
subWindowWidget->show();In this methods, "treeView" is a personalized QTreeView with a performed .ui, .cpp and .h.
-
[quote author="francescmm" date="1360145954"]You can create widgets at your own like "Qt Designer Form Class" and then add to a QMdiArea. The way to do this should be:
subWindowWidget = ui.mdiArea->addSubWindow(treeView,Qt::Widget);
subWindowWidget->show();In this methods, "treeView" is a personalized QTreeView with a performed .ui, .cpp and .h.
[/quote]
if you want to execute each widget separately then it could be more work required for developing your required app.
-
It is no true. If you want to execute each QWidget independently you only have to do widget.show() importing the .cpp and .h to the project you want.
The best way to insert widgets to a QMdiArea is creating a class member with a list of QMdiSubWindow pointers to each window.
If you need more information I can post my code.
-
[quote author="francescmm" date="1360145954"]You can create widgets at your own like "Qt Designer Form Class" and then add to a QMdiArea. The way to do this should be:
subWindowWidget = ui.mdiArea->addSubWindow(treeView,Qt::Widget);
subWindowWidget->show();In this methods, "treeView" is a personalized QTreeView with a performed .ui, .cpp and .h.
[/quote]
This was helpful! Thank you, francescmm for your contribution.
[quote]if you want to execute each widget separately then it could be more work required for developing your required app.[/quote]
Well... I appreciate this... however, as my first goal is to learn... I am already ready to add (even uselessly) unneeded extra work.
[quote author="francescmm" date="1360145954"]If you need more information I can post my code.[/quote]
That is very kind from you. I am much tempted to answer "Oh yes please!" but reason commands me to first try to figure this out by myself from the help you provided in your first post.I wont resist anyway in the unfortunate (but highly probable) case I just fail.
-
I recommend you that if your problem/dubt has been solved, type "(solved)" in the title of the topic.
-
OK, I managed to sort this out.
I had a compilation error with the line :
@subWindowWidget->show();@
Complaining that the subWindowWidget's structure was only partial or something like that anyway, so I amended your code the following way :
@Ps_Detview *ps_detview = new Ps_Detview;
ui->Pctrl_Mda->addSubWindow(ps_detview);
ps_detview->show();@
I cannot tell if this is formally correct but... it builds and... work !