Results 1 to 3 of 3

Thread: open window in parent mdi

  1. #1
    Join Date
    Dec 2010
    Location
    South Africa
    Posts
    56
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default open window in parent mdi

    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


    Qt Code:
    1. menu_reports *Menu = new menu_reports;
    2. ui->mdi1->addSubWindow(Menu);
    3. Menu->showMaximized();
    To copy to clipboard, switch view to plain text mode 

    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

    Qt Code:
    1. parent.mdi1
    2. parentwidget.mdi1
    To copy to clipboard, switch view to plain text mode 

    Any help will be greatly appreciated.
    Regards

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: open window in parent mdi

    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.

  3. #3
    Join Date
    Dec 2010
    Location
    South Africa
    Posts
    56
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: open window in parent mdi

    Signal sounds like a much better idea. thanks very much. ill try give it a go. if i have problem ill let you know.

Similar Threads

  1. Open QMainWindow to use xterm window as parent
    By muenalan in forum Qt Programming
    Replies: 0
    Last Post: 1st July 2010, 08:43
  2. Replies: 5
    Last Post: 21st April 2010, 21:36
  3. Open subwindow from parent window ctor
    By olidem in forum Qt Programming
    Replies: 11
    Last Post: 13th May 2009, 14:52
  4. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  5. Replies: 11
    Last Post: 4th June 2008, 07:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.