[SOLVED] QMdiSubWindow and Widget Checks
-
Hello,
I am using the following functions to add a subwindow to my mdiarea and to set a widget to the subwindow:
@ mdisubwindow->setWidget(widget); /Add the widget to the subwindow/
mdiarea->addSubWindow(mdisubwindow); /Add subwindow to the mdiarea/@I would like to put if statements prior to each call to
- first check if a widget has already been set to that particular subwindow
2)check if the subwindow has already been added to the mdiarea
So it should look like this:
@ if(!widget is already set to mdisubwindow)
{
mdisubwindow->setWidget(widget);
}
if(!subwindow is already added to mdiarea)
{
mdiarea->addSubWindow(mdisubwindow);
} @Any ideas would help because I cannot seem to find this anywhere...
Thanks
- first check if a widget has already been set to that particular subwindow
-
- mdisubwindow->widget() will give you a reference to the current widget if any.
- mdiarea->subWindowList() will give you a list of all the subwindows currently in the QMdiArea so you can check if mdisubwindow is among them.
-
[quote author="jazzycamel" date="1372435109"]1) mdisubwindow->widget() will give you a reference to the current widget if any.
2) mdiarea->subWindowList() will give you a list of all the subwindows currently in the QMdiArea so you can check if mdisubwindow is among them.[/quote]Thanks!