Squish: use new approach for markText()

This new approach is a bit slower than using Qt functionality,
but it's now completely relying on user-interaction.

Change-Id: I361f6f201dfff8122a11aae30204eb79967fe4ae
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2013-01-18 16:28:27 +01:00
parent 37828fb1cc
commit 4cb9f675aa
7 changed files with 25 additions and 34 deletions
+6 -11
View File
@@ -68,17 +68,12 @@ def openContextMenuOnTextCursorPosition(editor):
waitFor("menuVisibleAtEditor(editor, menuInList)", 5000)
return menuInList[0]
# this function marks/selects the text inside the given editor from position
# startPosition to endPosition (both inclusive)
def markText(editor, startPosition, endPosition):
cursor = editor.textCursor()
cursor.setPosition(startPosition)
cursor.movePosition(QTextCursor.StartOfLine)
editor.setTextCursor(cursor)
cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor, endPosition-startPosition)
cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
cursor.setPosition(endPosition, QTextCursor.KeepAnchor)
editor.setTextCursor(cursor)
# this function marks/selects the text inside the given editor from current cursor position
# param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well
# param typeCount defines how often the cursor will be moved in the given direction (while marking)
def markText(editor, direction, typeCount=1):
for i in range(typeCount):
type(editor, "<Shift+%s>" % direction)
# works for all standard editors
def replaceEditorContent(editor, newcontent):