Results 1 to 5 of 5

Thread: How to make modal widget wait for input after it is shown.

  1. #1
    Join Date
    Dec 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Question How to make modal widget wait for input after it is shown.

    I have a QWidget derived object, and "setWindowModality(Qt::WindowModal)" to it.
    Then I call "show()", however, the process did not get blocked there, although the widget is modal indeed.

    What I want is, how to make it work like "CDialog:: DoModal()" in MFC, the process will not go further until the dialog is dismissed.

  2. #2
    Join Date
    Jun 2009
    Posts
    74
    Thanks
    23
    Thanked 2 Times in 2 Posts

    Default Re: How to make modal widget wait for input after it is shown.

    maybe you need to call exec instead of show

  3. #3
    Join Date
    Dec 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to make modal widget wait for input after it is shown.

    It seems QWidget doesn't have "exec()"

  4. #4
    Join Date
    Jun 2009
    Posts
    74
    Thanks
    23
    Thanked 2 Times in 2 Posts

    Default Re: How to make modal widget wait for input after it is shown.

    according to QT document,
    Qt::WindowModal only makes sense for windows,so you can use isWindow () to check whether it is a window not not, if not , show will not block

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to make modal widget wait for input after it is shown.

    How about deriving from QDialog rather than QWidget?

Similar Threads

  1. Replies: 8
    Last Post: 27th October 2009, 09:07
  2. make a widget paint itself even thought it is not shown
    By momesana in forum Qt Programming
    Replies: 7
    Last Post: 28th April 2008, 11:57
  3. How to make my program wait for 2 seconds ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 26th December 2006, 13:31
  4. how to make program wait
    By psmech in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 05:24
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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.