Results 1 to 4 of 4

Thread: How to forbid close of one dialog and hide the cross

  1. #1
    Join Date
    Jul 2008
    Location
    Munich
    Posts
    73
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default How to forbid close of one dialog and hide the cross

    In a dialog I have a progressbar, which indicates very important program update. This process cannot be interrupted. So I need to forbid the default ESCAPE button press action and hide the cross of the dialog.

    What can I do to make this possible? Thanks.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to forbid close of one dialog and hide the cross

    You can use a QWidget (as a "window" for your update) instead of a QDialog, since that doesn't close on "Esc" press.

    And you can hide the close button by using a frame-less window flag:
    Qt Code:
    1. window->setWindowFlags(Qt::FramelessWindowHint);
    To copy to clipboard, switch view to plain text mode 

  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: How to forbid close of one dialog and hide the cross

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char **argv) {
    4. QApplication app(argc, argv);
    5.  
    6. QDialog dlg;
    7. dlg.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowTitleHint);
    8. return dlg.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jul 2008
    Location
    Munich
    Posts
    73
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to forbid close of one dialog and hide the cross

    Thanks!
    That is exactly what I am looking for!


Similar Threads

  1. How to close (exit) a dialog properly
    By cooper in forum Newbie
    Replies: 6
    Last Post: 9th March 2011, 19:19
  2. How do i close a buttonless dialog.
    By geekshlby in forum Newbie
    Replies: 12
    Last Post: 12th January 2010, 08:26
  3. Delete/Close Dialog correct?
    By kei in forum Qt Programming
    Replies: 8
    Last Post: 2nd July 2009, 13:51
  4. Close Dialog in showEvent
    By pospiech in forum Qt Programming
    Replies: 3
    Last Post: 11th April 2008, 15:32
  5. Block close dialog
    By Mrdata in forum Newbie
    Replies: 2
    Last Post: 12th March 2007, 15:39

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.