Results 1 to 2 of 2

Thread: QMdiArea and adding sub window

  1. #1
    Join Date
    Jan 2011
    Posts
    212
    Thanks
    24
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default QMdiArea and adding sub window

    Hello Forum,


    I have a instantiated an QMdiArea and i also have an widget - subclass of QGraphicsView

    which has been added as a subwindow of the mdi area. The mdi area object is set as a central widget in the main window. I want to have the QGraphicsView object maximized when the main window is loaded. I am trying to achieve it as follows:

    Qt Code:
    1. Editor = new NemoEditor(this,NULL,NULL);
    2. Editor->setWindowTitle(tr("Scene Hierarchy"));
    3.  
    4. Editor->setWindowState(Editor->windowState() | Qt::WindowFullScreen);
    5.  
    6. m_mdiArea->addSubWindow(m_h3dSceneEditor);
    7.  
    8. //!add the scene editor to the MDI area
    9. m_mdiArea->addSubWindow(Editor);
    To copy to clipboard, switch view to plain text mode 


    Is there anything missing from above since i do not get the subwindow maximized.

    By the way i am initializing the mdi area as follows:

    Qt Code:
    1. m_mdiArea = new QMdiArea(this);
    2. m_mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation,false);
    3.  
    4. //!set the mdi area as the central widget
    5. //!and this is how it is used in the main window
    6. setCentralWidget(m_mdiArea);
    To copy to clipboard, switch view to plain text mode 


    Any hint would be very helpful.


    Thanks
    Sajjad

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMdiArea and adding sub window

    try using setWindowState(Qt::WindowMaximized) on the sub window instance it self :
    Qt Code:
    1. m_mdiArea->addSubWindow(Editor)->setWindowState(Qt::WindowMaximized) ;
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Wish to have a QMdiSubWindow window larger than the QMdiArea
    By zenzero-2001 in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2010, 17:44
  2. Replies: 2
    Last Post: 13th May 2010, 17:46
  3. QMdiArea window needs two clicks to close
    By epsilon in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2010, 06:08
  4. Weird behavior when readding a window to a QMdiArea
    By seand in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2008, 02:14
  5. Adding scroll bars to a main window
    By dougab in forum Newbie
    Replies: 9
    Last Post: 25th December 2007, 20:27

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
  •  
Qt is a trademark of The Qt Company.