Results 1 to 2 of 2

Thread: Need a Task/Main Window that is neither SDI nor MDI

  1. #1
    Join Date
    Oct 2009
    Location
    Vienna, Austria
    Posts
    57
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Need a Task/Main Window that is neither SDI nor MDI

    I'm in the process of migrating a multi-platform application to Qt4 I would need to provide the concept of a "Task Window" (conceptually this might be what Qt calls QMainWindow) as follows:
    1) The task window is a visible window that provides an enclosure of all application windows (not on the Macintosh platform where it the task window itself is virtual/invisible and only shows the application menu bar)
    2) The task window has the application menu bar and (eventually) a status bar but no toolbar
    3) Using the menu bar of the task window the user now opens application windows that will be enclosed in the task window but can also have their own menu bar, toolbar and status bar
    4) The task window keeps track of the applications windows and offers a menu showing all open application windows
    5) When closing the task window all application windows should be notified and closed (if allowed by the application window)

    I'm struggling to understand how to be model this in Qt and it seems as if what I need is somewhere between the concept of MDI and SDI. Any help or comments is appreciated.

  2. #2
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Need a Task/Main Window that is neither SDI nor MDI

    What you describe should be possible with a classic QMainWindow/QMDIArea setup. You would then decorate the QMDISubWindows using the classes QToolBar, QStatusBarand QMenuBar. These classes aren't limited to be used with the QMainWindow.

    EDIT:
    I just realized you can add a QMainWindow to a QMainWindow.
    Try the following:
    Qt Code:
    1. #include <QtGui>
    2.  
    3. QMainWindow* newWindow(int i=2)
    4. {
    5. QMainWindow* w=new QMainWindow(0,0);
    6. w->menuBar()->addMenu("&File");
    7. QMdiArea* a = new QMdiArea;
    8. w->setCentralWidget(a);
    9. w->statusBar()->showMessage(QString("Level %1").arg(i));
    10. w->addToolBar("")->addAction(new QAction("A", w));
    11. if(i)
    12. a->addSubWindow(newWindow(--i));
    13. return w;
    14. }
    15.  
    16. int main(int argc, char* argv[])
    17. {
    18. QApplication app(argc, argv);
    19. newWindow()->show();
    20. return app.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 
    mainwindow..png
    Last edited by spud; 14th April 2010 at 08:18.

  3. The following user says thank you to spud for this useful post:

    doberkofler (15th April 2010)

Similar Threads

  1. Task Window in Qt
    By doberkofler in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 08:00
  2. Replies: 11
    Last Post: 11th August 2008, 09:14
  3. Main Window
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2007, 07:32
  4. Replies: 15
    Last Post: 23rd March 2007, 16:16
  5. Getting main window to run.
    By Doug Broadwell in forum Newbie
    Replies: 5
    Last Post: 17th October 2006, 23:56

Tags for this Thread

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.