Results 1 to 5 of 5

Thread: A Dialog that cannot be exited

  1. #1
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default A Dialog that cannot be exited

    I want to make like an Autoupdate dialog, that cannot be exited, closed, or interrupted.
    Is there a way for QDialog to remove the "X" button and possible not close until some sort of signal or another class says it can?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: A Dialog that cannot be exited

    Try reimplementing QDialog::done(), if it's not enough, you can always reimplement QWidget::closeEvent().

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A Dialog that cannot be exited

    I would just use a frameless modal widget for that - no window buttons tempting to be pressed

  4. #4
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A Dialog that cannot be exited

    Closes the dialog and sets its result code to r. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return r.

    This is what it says for QDialog::done... so I don't think that disables the X button etc.
    I know in Win API they had WS_ window style options to hide certain menus, such as "x", minimize, or the title bar. Is there anything like that for QDialog?

    I used designer to make the QDialog, so I dont know how I would convert it to a modal widget without a frame.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A Dialog that cannot be exited

    Set a Qt::FramelessWindowHint flag for your widget (it doesn't have to be a dialog, unless you need the local event loop).

  6. The following user says thank you to wysota for this useful post:

    VireX (26th March 2007)

Similar Threads

  1. Replies: 1
    Last Post: 1st February 2007, 17:07
  2. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  3. Replies: 3
    Last Post: 23rd July 2006, 18:02
  4. Show/hide part of dialog with resizing.
    By Spockmeat in forum Qt Tools
    Replies: 6
    Last Post: 7th June 2006, 08:22
  5. Dialog positioning in GNOME
    By simk in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2006, 09:41

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.