Quote:
Originally Posted by chaley
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)
|
Chaley, thank you kindly. I was prepared to AstroGrep through \calibre-master\src\calibre\ to find the keypress event filter that keeps Calibre itself from closing. Your snippet is much appreciated.
DaltonST