TextEditor

Since: BlackBerry 10.0.0

#include <bb/cascades/TextEditor>

Use for text selection and editing.


Overview

QML properties

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

Properties Index

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

Public Functions Index

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

Signals Index

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

Properties

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

QString selectedText[read-only]

Currently selected text.

The currently seleced text in plain text format.

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

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

Public Functions

int cursorPosition ()

The cursor position.

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

void resetCursorPosition ()

Resets the cursor position to its default value of 0.

Since:

BlackBerry 10.0.0

QString selectedText ()

Returns the currently selected text.

Return:

The currently selected text in plain text.

Since:

BlackBerry 10.0.0

int selectionEnd ()

The end of the selection range.

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

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

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

Signals

void cursorPositionChanged (
  • intcursorPosition)

Emitted when the cursor position has changed.

Parameters
cursorPosition

The new cursor position.

Since:

BlackBerry 10.0.0

void selectedTextChanged (

Emitted when the selected text has changed.

Parameters
selectedText

The new selected text.

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

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

Last modified: 2014-03-13

comments powered by Disqus