Escape in QDialog works only in modal mode?
-
Escdoes not work for my dialog in non-modal mode, event going to underlying window. Only addingsetWindowModality(Qt::WindowModal);to the dialog on creation makes the
Esckey work and calls thereject()slot. Is it normal or possible toEscin/from non-modal dialog? -
Changed
dialog->show();call to
// Shows the dialog as a modal dialog, blocking until the user closes it. dialog->exec();Works fine for now. Seems the only way to catch event in the dialog, non-modal does not allow this or use key event filter as mentioned in another answer: https://stackoverflow.com/a/49072065/630169