Enum controlling whether moving the cursor moves the anchor or keeps it to extend the selection.
// TextCursor.MoveMode controls whether cursor movement clears or extends selection. const root = new Widget(parent); const layout = new BoxLayout(); layout.setDirection(Direction.TopToBottom); root.layout = layout; const edit = new TextEdit(root); edit.plainText = 'Select some text here to test MoveMode.'; layout.addWidget(edit); const cursor = edit.textCursor; // MoveAnchor: moves cursor and clears any selection cursor.movePosition(TextCursor.MoveOperation.Start, TextCursor.MoveMode.MoveAnchor); // KeepAnchor: moves cursor but keeps anchor, creating a selection cursor.movePosition(TextCursor.MoveOperation.EndOfLine, TextCursor.MoveMode.KeepAnchor); Copy
// TextCursor.MoveMode controls whether cursor movement clears or extends selection. const root = new Widget(parent); const layout = new BoxLayout(); layout.setDirection(Direction.TopToBottom); root.layout = layout; const edit = new TextEdit(root); edit.plainText = 'Select some text here to test MoveMode.'; layout.addWidget(edit); const cursor = edit.textCursor; // MoveAnchor: moves cursor and clears any selection cursor.movePosition(TextCursor.MoveOperation.Start, TextCursor.MoveMode.MoveAnchor); // KeepAnchor: moves cursor but keeps anchor, creating a selection cursor.movePosition(TextCursor.MoveOperation.EndOfLine, TextCursor.MoveMode.KeepAnchor);
Moves only the cursor while keeping the anchor fixed, extending or creating a selection.
Moves both the cursor and the anchor to the new position, collapsing any selection.
Enum controlling whether moving the cursor moves the anchor or keeps it to extend the selection.
Example