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!!!