Results 1 to 4 of 4

Thread: MainWindow+Dialogs

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default MainWindow+Dialogs

    Hi, I've a QMainWindow with inside its layout a menu of pusbuttons and a groupbox. The behaviou of my gui is this one:
    - when a click on a push button of the menu I want open something like a dialog inside the area of a groupbox without create a new window for the dialog.
    Is possible to do this?
    For the moment instead of creating a real qdialog, a create a custom qwidget and it work:
    myWidget * pMyWidget = newMyWidget();
    myGroupBoxLayout->addWidget(pMyWidget );
    However I have a problem of management (I think it's too hard) with this idea in the case of cascade calling of this sort of "dialogs":
    MainWidow open MyWidget1, clicking on a button of this one it open MyWidget2 (always inside the area of the groupbox), clicking on a button of this one it open MyWidget3 always inside the area of the groupbox). Closing MyWidget3 must reappear MyWidget2, and closing MyWidget2 must reappear MyWidget1.
    Any idea to solve this task?
    Last edited by fruzzo; 19th May 2008 at 11:45.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MainWindow+Dialogs

    Have a look at QStackedWidget.

    Also have a look at the Configuration Dialog example in QtDemo.

  3. #3
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: MainWindow+Dialogs

    Quote Originally Posted by aamer4yu View Post
    Have a look at QStackedWidget.

    Also have a look at the Configuration Dialog example in QtDemo.
    Ok that's what I want...I try to use it and works fine. I 've only 2 problems...when I put a widget on the top, and I try to modify the properties of a qlabel of it, for example, the application crash! I don' know if this behaviour is releted to the wrong management of the qwidgetstack or no.
    The other problem, may be related to the first, is using the method raiseWidget ( QWidget * w ).
    I create:
    MyWidget * myWid = new MyWidget (widgetStack)
    widgetStack->addWidget(myWid, id)
    but when I call
    widgetStack-> raiseWidget (myWid)
    to put the widget on top the application crash.
    The only way is to use:
    widgetStack-> raiseWidget (id)
    Why?
    Last edited by fruzzo; 20th May 2008 at 09:55.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: MainWindow+Dialogs

    Quote Originally Posted by fruzzo View Post
    I 've only a problem...when I put a widget on the top, and I try to modify the properties of a qlabel of it, for example, the application crash!
    I don' know if this behaviour is releted to the wrong management of the qwidgetstack or no.
    It could be anything. Provided this information, there's not much we can say about it. Please, provide at least the backtrace from a debugger.
    J-P Nurmi

Similar Threads

  1. Notifying Mainwindow of an event..
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2007, 22:29
  2. Replies: 1
    Last Post: 11th September 2007, 14:34
  3. Replies: 8
    Last Post: 4th September 2007, 14:25
  4. Replies: 3
    Last Post: 23rd July 2006, 19:02
  5. mainwindow does not refresh
    By edb in forum Qt Programming
    Replies: 22
    Last Post: 25th January 2006, 17:42

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.