forked from openlp/openlp
Inconvenient focus in Song Editor when adding authors) by reimplementing the keyPressEvent
bzr-revno: 2133
This commit is contained in:
commit
d74a484f56
@ -132,6 +132,26 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
|
self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
|
||||||
self.whitespace = re.compile(r'\W+', re.UNICODE)
|
self.whitespace = re.compile(r'\W+', re.UNICODE)
|
||||||
|
|
||||||
|
def keyPressEvent(self, event):
|
||||||
|
"""
|
||||||
|
Reimplement the keyPressEvent to react on Return/Enter keys. When some
|
||||||
|
combo boxes have focus we do not want dialog's default action be
|
||||||
|
triggered but instead our own.
|
||||||
|
|
||||||
|
``event``
|
||||||
|
A QtGui.QKeyEvent event.
|
||||||
|
"""
|
||||||
|
if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
|
||||||
|
if self.authorsComboBox.hasFocus() and \
|
||||||
|
self.authorsComboBox.currentText():
|
||||||
|
self.onAuthorAddButtonClicked()
|
||||||
|
return
|
||||||
|
if self.topicsComboBox.hasFocus() and \
|
||||||
|
self.topicsComboBox.currentText():
|
||||||
|
self.onTopicAddButtonClicked()
|
||||||
|
return
|
||||||
|
QtGui.QDialog.keyPressEvent(self, event)
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.verseEditButton.setEnabled(False)
|
self.verseEditButton.setEnabled(False)
|
||||||
self.verseDeleteButton.setEnabled(False)
|
self.verseDeleteButton.setEnabled(False)
|
||||||
|
Loading…
Reference in New Issue
Block a user