Results 1 to 4 of 4

Thread: Widget over modal dialog

  1. #1
    Join Date
    Apr 2009
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Widget over modal dialog

    Hi,

    Here's my problem:

    * Launch a modal dialog where some input parameters to the main app. can be set.
    * Modal dialog contains a 'plot' button that launches a widget displaying a 2D plot visualizing some consequences of the parameter settings.
    * When the plot window is shown, the window is always underneath the modal dialog.

    Is it possible to make the plot appear on top of the main modal dialog, provided its the active window? That is, relative to the main dialog is should behave like a completely normal window.

    To me it makes sense to do something like this, but correct me if I'm wrong.

    BTW: The main dialog from where the 2D plot is launched, takes care of closing the 2D plot if its open.

    Best regards,

    Mads

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Widget over modal dialog

    If the modal dialog and the plot widget are both siblings (that is, children of the same parent, for example, the main dialog), then you should be able to call plot->raise() after you show the plot window. See QWidget::raise(). Alternatively, you could call QWidget::stackUnder() using the plot as the QWidget to be on top.

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Widget over modal dialog

    Make Modal Dialog parent of Widget (which has the plot), while creating the Widget
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    Apr 2009
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Widget over modal dialog

    Quote Originally Posted by d_stranz View Post
    If the modal dialog and the plot widget are both siblings (that is, children of the same parent, for example, the main dialog), then you should be able to call plot->raise() after you show the plot window. See QWidget::raise(). Alternatively, you could call QWidget::stackUnder() using the plot as the QWidget to be on top.
    Thanks, will try it.

Similar Threads

  1. modal dialog in mouseReleaseEvent
    By cresta in forum Qt Programming
    Replies: 0
    Last Post: 14th October 2011, 03:18
  2. Replies: 3
    Last Post: 17th December 2010, 02:06
  3. Non-Modal about dialog?
    By N3wb in forum Qt Programming
    Replies: 1
    Last Post: 8th December 2010, 05:47
  4. QT Modal Dialog
    By jiapei100 in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2010, 17:15
  5. System modal dialog!!
    By boss_bhat in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2006, 07:01

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.