Results 1 to 5 of 5

Thread: QMdiArea- closing the Previous subWindow when opening new subWindow is crasing.....

  1. #1
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default QMdiArea- closing the Previous subWindow when opening new subWindow is crasing.....

    Hi all,
    I am workin on a designer application which i have created by using Qt Mdi app model... When i am creating a new page(work space) and adding it to the MDI area. As a normal MDI app all the sub Windows will be shown at a time in the MDI Area. But i need to show only one subWindow at a time... Whnever i am opening a new page it should close the previous page and open the new one... when i was trying to use this my app get crashed..
    Qt Code:
    1. void CWindowController :: createWorkspace()
    2. {
    3. Qt::WindowFlags flags;
    4. flags = Qt::Window | Qt::WindowMinimizeButtonHint;
    5. static int pageNumber = 0;
    6. pageNumber++;
    7.  
    8. newPage = CWidgetFactory::getInstance()->createPage();
    9. newPage->setSize(800,480);
    10. newPage->setAutoFillBackground(true);
    11. QString name = QString("Page_%1").arg(pageNumber);
    12. newPage->setWidgetName(name);
    13. newPage->setWindowTitle(name);
    14.  
    15. if(mdiArea->activeSubWindow())
    16. {
    17. mdiArea->activeSubWindow()->close();
    18. }
    19. QMdiSubWindow* subWindow = mdiArea->addSubWindow(newPage,flags);
    20. subWindow->resize(newPage->size());
    21. newPage->show();
    22. }
    To copy to clipboard, switch view to plain text mode 
    This is the sample code for creating work space.... Is there any other way to implement this... And in my designer i ll be having one project viewer too which will show all the page names in tree view... when i click on a page name, i need to close the current page on the work space and load this new page on to the work space.. any IDEA!!!
    Make everything Simple yet Powerful

  2. #2
    Join Date
    Sep 2011
    Location
    Mannheim, Germany
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMdiArea- closing the Previous subWindow when opening new subWindow is crasing...

    In which line does it crash exactly?

  3. #3
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QMdiArea- closing the Previous subWindow when opening new subWindow is crasing...

    After creating these newPages in the createWorkspace method i ll be adding these page objects to QList<Page*>. When i am trying to access this page names using getWidgetName() which returns the name of the page it crashes, i am geting an "Unavailable synchronous data" value on that page instance...This shows while debugging....
    Make everything Simple yet Powerful

  4. #4
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QMdiArea- closing the Previous subWindow when opening new subWindow is crasing...

    I have fixed that crash... Whenever i am creating a new page and placing as an MDI child its width & height will be always minimum even though i am giving the size for that page... I have made modification i the above code... I llnot be using QMdiSubWindow to add the page, instead i ll be directly giving like this..
    Qt Code:
    1. mdiArea->addSubWindow(newPage,flags);
    2. newPage->resize(800, 480);
    3. newPage->show();
    To copy to clipboard, switch view to plain text mode 
    I have tried calling methods like update(), updateGeometry(), repaint(), but cause nothing it still shows the page with minimum size..I have tried so many workaround but nothing helped... Any suggestion regarding this.....
    How can add a new widget to the QMdiArea without using an QMdiSubWindow class instance?
    Make everything Simple yet Powerful

  5. #5
    Join Date
    Sep 2011
    Location
    Mannheim, Germany
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMdiArea- closing the Previous subWindow when opening new subWindow is crasing...

    I use always showMaximized(); for the inner widget.

Similar Threads

  1. QMdiArea subwindow size always minimized
    By Plissken in forum Newbie
    Replies: 0
    Last Post: 15th July 2012, 23:42
  2. QMdiArea: Maximaized SubWindow in background?
    By JohnnyRep in forum Qt Programming
    Replies: 4
    Last Post: 23rd March 2012, 19:19
  3. QMdiArea / SubWindow Problem
    By ericV in forum Qt Programming
    Replies: 2
    Last Post: 19th September 2009, 01:09
  4. QMdiArea/SubWindow issue...
    By b1 in forum Qt Programming
    Replies: 3
    Last Post: 2nd September 2009, 09:22
  5. QMdiArea how to connect the subwindow changed
    By SamSong in forum Qt Programming
    Replies: 3
    Last Post: 21st May 2009, 03:15

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.