View Full Version : QDialog - how to stop hide on "ESC"?
will49
27th May 2008, 15:10
I have a modal dialog box that I need to be displayed until I'm finished some processing. However the user can close/hide the dialog by pressing the "ESC" key. How can I override this default behavior in QDialog so I can stop it from doing this?
If the user presses the Esc key in a dialog, QDialog::reject() will be called. You can reimplement that function to do nothing under certain circumstances:
void MyDialog::reject()
{
if (itsOkToClose)
{
QDialog::reject();
}
}
will49
27th May 2008, 16:40
Great. That worked.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.