openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19290
[Merge] lp:~googol/openlp/bug-1047995-2 into lp:openlp/2.0
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-1047995-2 into lp:openlp/2.0.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1047995 in OpenLP: "Inconvenient focus in Song Editor when adding authors"
https://bugs.launchpad.net/openlp/+bug/1047995
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-1047995-2/+merge/147607
Hello,
- fixed bug 1047995 (Inconvenient focus in Song Editor when adding authors) by reimplementing the keyPressEvent
--
https://code.launchpad.net/~googol/openlp/bug-1047995-2/+merge/147607
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-1047995-2 into lp:openlp/2.0.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2013-02-11 08:39:20 +0000
@@ -132,6 +132,26 @@
self.findVerseSplit = re.compile(u'---\[\]---\n', 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):
self.verseEditButton.setEnabled(False)
self.verseDeleteButton.setEnabled(False)
Follow ups