Also capture the return key for the replace box

This commit is contained in:
Veronica K. B. Olsen
2020-08-16 15:10:02 +02:00
parent fa1c79a1da
commit accae5e074
+7 -2
View File
@@ -649,7 +649,7 @@ class GuiDocEditor(QTextEdit):
"""
isReturn = keyEvent.key() == Qt.Key_Return
isReturn |= keyEvent.key() == Qt.Key_Enter
if isReturn and self.docSearch.searchBox.hasFocus():
if isReturn and self.docSearch.anyFocus():
return
elif keyEvent == QKeySequence.Redo:
self.docAction(nwDocAction.REDO)
@@ -1425,7 +1425,7 @@ class GuiDocEditSearch(QFrame):
self.replaceBox = QLineEdit(self)
self.replaceBox.setFont(boxFont)
self.replaceBox.setPlaceholderText("Replace")
self.replaceBox.returnPressed.connect(self._doSearch)
self.replaceBox.returnPressed.connect(self._doReplace)
self.searchOpt = QToolBar(self)
self.searchOpt.setToolButtonStyle(Qt.ToolButtonIconOnly)
@@ -1591,6 +1591,11 @@ class GuiDocEditSearch(QFrame):
return True
return False
def anyFocus(self):
"""Returns true if any of the input boxes have focus.
"""
return self.searchBox.hasFocus() | self.replaceBox.hasFocus()
##
# Get and Set Functions
##