PDA

View Full Version : open window in parent mdi



ShapeShiftme
8th May 2011, 04:27
Good day all.

This is my problem.
I have a page that is a subwindow of mdi1 in my code. this page is opened from the tool bar usinf the following code




menu_reports *Menu = new menu_reports;
ui->mdi1->addSubWindow(Menu);
Menu->showMaximized();


This works fine. but on this page i have another button that must open another window but it must also be pen as a subwindow of mdi1.

So what i would like to know is how do i reference mdi from the open form.
as the following does not work



parent.mdi1
parentwidget.mdi1


Any help will be greatly appreciated.
Regards

ChrisW67
8th May 2011, 06:14
The parent of the widget inside the MDI sub-window is the child of the QMDISubwindow not the QMDIArea. You could try to qobject_cast the grandparent of your menu_reports instance and use that. However, I'd be inclined to emit a signal from menu_reports that is connected to a slot in the parent of the MDI area and have that open another sub-window.

ShapeShiftme
8th May 2011, 07:07
Signal sounds like a much better idea. thanks very much. ill try give it a go. if i have problem ill let you know.