Back-references not consideres all tags in a document, not just the first one

This commit is contained in:
Veronica K. B. Olsen
2020-05-25 21:14:50 +02:00
parent e7f0751275
commit 3b7927f0ff
8 changed files with 81 additions and 34 deletions
+27
View File
@@ -206,6 +206,33 @@ class GuiDocViewer(QTextBrowser):
self.docTitle.setTitleFromHandle(self.theHandle)
return
##
# Setters
##
def setCursorPosition(self, thePosition):
"""Move the cursor to a given position in the document.
"""
if not isinstance(thePosition, int):
return False
if thePosition >= 0:
theCursor = self.textCursor()
theCursor.setPosition(thePosition)
self.setTextCursor(theCursor)
return True
def setCursorLine(self, theLine):
"""Move the cursor to a given line in the document.
"""
if not isinstance(theLine, int):
return False
if theLine >= 0:
theBlock = self.qDocument.findBlockByLineNumber(theLine)
if theBlock:
self.setCursorPosition(theBlock.position())
logger.verbose("Cursor moved to line %d" % theLine)
return True
##
# Events
##