forked from openlp/openlp
do not react on ESC/Enter/Return event when closing the dialog
This commit is contained in:
parent
8d164cd21e
commit
b6efe5393d
@ -56,6 +56,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.changedActions = {}
|
self.changedActions = {}
|
||||||
self.action_list = ActionList.get_instance()
|
self.action_list = ActionList.get_instance()
|
||||||
|
self.dialog_was_shown = False
|
||||||
QtCore.QObject.connect(self.primaryPushButton, QtCore.SIGNAL(u'toggled(bool)'), self.onPrimaryPushButtonClicked)
|
QtCore.QObject.connect(self.primaryPushButton, QtCore.SIGNAL(u'toggled(bool)'), self.onPrimaryPushButtonClicked)
|
||||||
QtCore.QObject.connect(self.alternatePushButton, QtCore.SIGNAL(u'toggled(bool)'),
|
QtCore.QObject.connect(self.alternatePushButton, QtCore.SIGNAL(u'toggled(bool)'),
|
||||||
self.onAlternatePushButtonClicked)
|
self.onAlternatePushButtonClicked)
|
||||||
@ -91,6 +92,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
"""
|
"""
|
||||||
if not self.primaryPushButton.isChecked() and not self.alternatePushButton.isChecked():
|
if not self.primaryPushButton.isChecked() and not self.alternatePushButton.isChecked():
|
||||||
return
|
return
|
||||||
|
# Do not continue, as the event is for the dialog (close it).
|
||||||
|
if self.dialog_was_shown and event.key() in (QtCore.Qt.Key_Escape, QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
|
||||||
|
self.dialog_was_shown = False
|
||||||
|
return
|
||||||
key = event.key()
|
key = event.key()
|
||||||
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
||||||
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
||||||
@ -425,6 +430,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
'The shortcut "%s" is already assigned to another action, please use a different shortcut.') %
|
'The shortcut "%s" is already assigned to another action, please use a different shortcut.') %
|
||||||
key_sequence.toString()
|
key_sequence.toString()
|
||||||
)
|
)
|
||||||
|
self.dialog_was_shown = True
|
||||||
return is_valid
|
return is_valid
|
||||||
|
|
||||||
def _actionShortcuts(self, action):
|
def _actionShortcuts(self, action):
|
||||||
|
Loading…
Reference in New Issue
Block a user