Commit 4d6cb992 authored by Robert Loehning's avatar Robert Loehning

Squish: Use generic function textUnderCursor(...)

Change-Id: I7ea6e9af1435e716266f4dfd917fe9ac568a67a5
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 62fed3c4
......@@ -112,19 +112,16 @@ def selectFromLocator(filter, itemName = None):
doubleClick(wantedItem, 5, 5, 0, Qt.LeftButton)
def wordUnderCursor(window):
cursor = window.textCursor()
oldposition = cursor.position()
cursor.movePosition(QTextCursor.StartOfWord)
cursor.movePosition(QTextCursor.EndOfWord, QTextCursor.KeepAnchor)
returnValue = cursor.selectedText()
cursor.setPosition(oldposition)
return returnValue
return textUnderCursor(window, QTextCursor.StartOfWord, QTextCursor.EndOfWord)
def lineUnderCursor(window):
return textUnderCursor(window, QTextCursor.StartOfLine, QTextCursor.EndOfLine)
def textUnderCursor(window, fromPos, toPos):
cursor = window.textCursor()
oldposition = cursor.position()
cursor.movePosition(QTextCursor.StartOfLine)
cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
cursor.movePosition(fromPos)
cursor.movePosition(toPos, QTextCursor.KeepAnchor)
returnValue = cursor.selectedText()
cursor.setPosition(oldposition)
return returnValue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment