mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-29 09:09:40 +12:00
Fix most problems regarding issue #1065
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
414cd0f8a3
commit
380354bdf8
|
@ -46,13 +46,19 @@ class widgetSelectionHighlighter():
|
||||||
def _highlightTextEditSearchResult(self, textEdit, startPos, endPos, clearOnFocusOut):
|
def _highlightTextEditSearchResult(self, textEdit, startPos, endPos, clearOnFocusOut):
|
||||||
# On focus out, clear text edit selection.
|
# On focus out, clear text edit selection.
|
||||||
oldTextCursor = textEdit.textCursor()
|
oldTextCursor = textEdit.textCursor()
|
||||||
if clearOnFocusOut:
|
|
||||||
self.generateClearHandler(textEdit, lambda widget: widget.setTextCursor(oldTextCursor))
|
|
||||||
|
|
||||||
# Highlight search result on the text edit.
|
|
||||||
c = textEdit.textCursor()
|
c = textEdit.textCursor()
|
||||||
c.setPosition(startPos)
|
c.setPosition(startPos)
|
||||||
c.setPosition(endPos, QTextCursor.KeepAnchor)
|
c.setPosition(endPos, QTextCursor.KeepAnchor)
|
||||||
|
|
||||||
|
if clearOnFocusOut:
|
||||||
|
def clearSelection(widget):
|
||||||
|
cur = widget.textCursor()
|
||||||
|
if cur.hasSelection() and cur.anchor() == startPos and cur.position() == endPos:
|
||||||
|
widget.setTextCursor(oldTextCursor)
|
||||||
|
|
||||||
|
self.generateClearHandler(textEdit, clearSelection)
|
||||||
|
|
||||||
|
# Highlight search result on the text edit.
|
||||||
textEdit.setTextCursor(c)
|
textEdit.setTextCursor(c)
|
||||||
|
|
||||||
def _highlightLineEditSearchResult(self, lineEdit, startPos, endPos, clearOnFocusOut):
|
def _highlightLineEditSearchResult(self, lineEdit, startPos, endPos, clearOnFocusOut):
|
||||||
|
|
Loading…
Reference in a new issue