Squish: Replaced function moveTextCursor

Change-Id: Ie4cccd0de668690a3d66baf422bcfff7acae7345
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
This commit is contained in:
Robert Loehning
2012-05-25 11:52:01 +02:00
committed by Robert Löhning
parent 53fb9d4ae8
commit ea63b86e49
5 changed files with 22 additions and 34 deletions

View File

@@ -30,21 +30,6 @@ def placeCursorToLine(editor, line, isRegex=False):
editor.setTextCursor(cursor)
return True
# this function moves the text cursor of an editor by using Qt internal functions
# this is more reliable (especially on Mac) than the type() approach
# param editor an editor object
# param moveOperation a value of enum MoveOperation (of QTextCursor)
# param moveAnchor a value of enum MoveMode (of QTextCursor)
# param n how often repeat the move operation?
def moveTextCursor(editor, moveOperation, moveAnchor, n=1):
if not editor or isinstance(editor, (str,unicode)):
test.fatal("Either got a NoneType or a string instead of an editor object")
return False
textCursor = editor.textCursor()
result = textCursor.movePosition(moveOperation, moveAnchor, n)
editor.setTextCursor(textCursor)
return result
# this function returns True if a QMenu is
# popped up above the given editor
# param editor is the editor where the menu should appear