Quote:
Originally Posted by DaltonST
[2] Escape natively closes all Qt Widgets; that is a Qt thing that I also dislike.
DaltonST
|
I had this problem in the template tester dialog. Solved it by checking key presses for the ESC key.
Code:
def keyPressEvent(self, ev):
if ev.key() == Qt.Key.Key_Escape:
# Check about ESC to avoid killing the dialog by mistake
if self.textbox.toPlainText() != self.original_text:
r = question_dialog(self, _('Discard changes?'),
_('Do you really want to close this dialog, discarding any changes?'))
if not r:
return
QDialog.keyPressEvent(self, ev)