TextEditor

#include <bb/cascades/TextEditor>

Use for text selection and editing.

Since:

BlackBerry 10.0.0

QML properties

selectedText: QString [read-only]
cursorPosition: int
selectionStart: int [read-only]
selectionEnd: int [read-only]

Properties Index

QStringselectedText [read-only]
intcursorPosition
intselectionStart [read-only]
intselectionEnd [read-only]

Public Functions Index

QStringselectedText () const
intcursorPosition () const
intselectionStart () const
intselectionEnd () const
Q_INVOKABLE voidinsertPlainText (QString text)
Q_INVOKABLE voidsetSelection (int start, int end)
voidsetCursorPosition (int cursorPosition)
voidresetCursorPosition ()

Signals Index

voidselectedTextChanged (QString selectedText)
voidcursorPositionChanged (int cursorPosition)
voidselectionStartChanged (int selectionStart)
voidselectionEndChanged (int selectionEnd)

Properties

QString selectedText[read-only]

Currently selected text.

The currently seleced text in plain text format.

Since:

BlackBerry 10.0.0

int cursorPosition

The cursor position.

The default value is 0. Setting a value less then zero or beyond the end of the document will result in clamping. Setting the cursor position will reset the current selection.

Since:

BlackBerry 10.0.0

int selectionStart[read-only]

The position of the start of the selection range.

The default value is 0. Setting a value less then zero or beyond the end of the document will result in clamping.

Since:

BlackBerry 10.0.0

int selectionEnd[read-only]

The position of the end of the selection range.

The default value is 0. Setting a value less then zero or beyond the end of the document will result in clamping.

Since:

BlackBerry 10.0.0

Public Functions

QString selectedText ()

Returns the currently selected text.

Return:

The currently selected text in plain text.

Since:

BlackBerry 10.0.0

int cursorPosition ()

The cursor position.

The default value is 0.

Since:

BlackBerry 10.0.0

int selectionStart ()

The start of the selection range.

The default value is 0.

Since:

BlackBerry 10.0.0

int selectionEnd ()

The end of the selection range.

The default value is 0.

Since:

BlackBerry 10.0.0

Q_INVOKABLE void insertPlainText (

Insert text at the current position.

Inserts unformatted text at the current position, replaces any selection. The text will be formatted according to the format at the insertion point.

Parameters
text

The text to insert

Since:

BlackBerry 10.0.0

Q_INVOKABLE void setSelection (
  • intstart,
  • intend )

Set the selection.

Set the selection between start and end and places the cursor at the end position. Setting end < start will result in undefined behaviour.

Parameters
start

Start position of selection Values less then zero or beyond the end of the document length will be clamped.

end

End position of selection Values less then zero or beyond the end of the document length will be clamped.

Since:

BlackBerry 10.0.0

void setCursorPosition (
  • intcursorPosition)

Set the cursor position.

Parameters
cursorPosition

The new cursor position Values less then zero or beyond the end of the document length will be clamped.

Since:

BlackBerry 10.0.0

void resetCursorPosition ()

Resets the cursor position to its default value of 0.

Since:

BlackBerry 10.0.0

Signals

void selectedTextChanged (

Emitted when the selected text has changed.

Parameters
selectedText

The new selected text.

Since:

BlackBerry 10.0.0

void cursorPositionChanged (
  • intcursorPosition)

Emitted when the cursor position has changed.

Parameters
cursorPosition

The new cursor position.

Since:

BlackBerry 10.0.0

void selectionStartChanged (
  • intselectionStart)

Emitted when the start of the selection range has changed.

Parameters
selectionStart

The new start of the selection.

Since:

BlackBerry 10.0.0

void selectionEndChanged (
  • intselectionEnd)

Emitted when the end of the selection range has changed.

Parameters
selectionEnd

The new end of the selection.

Since:

BlackBerry 10.0.0