User Tools

Site Tools


DzTextEdit

Script wrapper for QTextEdit.

More...

Inherits :

Inherited By : DzTextBrowser

Enumerations

Properties

Constructors

DAZ Script
DzTextEdit ( DzWidget parent )

Methods

DAZ Script
StringanchorAt ( Point pos )
voidappend ( String text )
voidbackspace ()
voidbackspaceWord ()
voidclear ()
voidcopy ()
voidcursorBackward ( Boolean mark=false, Number steps=1 )
voidcursorForward ( Boolean mark=false, Number steps=1 )
voidcursorWordBackward ( Boolean mark=false, Number steps=1 )
voidcursorWordForward ( Boolean mark=false, Number steps=1 )
voidcut ()
voiddel ()
voiddeleteWord ()
voiddown ( Boolean mark=false, Number steps=1 )
voidend ( Boolean mark=false )
voidensureCursorVisible ()
Booleanfind ( String expression, Boolean caseSensitive=false, Boolean wholeWord=false, Boolean backward=false )
BooleanhasSelectedText ()
voidhome ( Boolean mark=false )
voidinsertBlock ()
voidinsertHtml ( String text )
voidinsertPlainText ( String text )
voidlineEnd ( Boolean mark=false )
voidlineStart ( Boolean mark=false )
voidpageDown ( Boolean mark=false )
voidpageUp ( Boolean mark=false )
voidpaste ()
voidredo ()
voidscrollToAnchor ( String name )
voidselectAll ()
StringselectedText ()
NumberselectionEnd ()
NumberselectionStart ()
Stringtext ( Number blockIdx )
voidundo ()
voidup ( Boolean mark=false, Number steps=1 )
voidzoomIn ( Number range=1 )
voidzoomOut ( Number range=1 )

Signals

voidcopyAvailable ( Boolean yesNo )
voidcursorPositionChanged ()
voidredoAvailable ( Boolean yesNo )
voidselectionChanged ()
voidtextChanged ()
voidundoAvailable ( Boolean yesNo )

Detailed Description

Provides a powerful single-page rich text editor widget.

Enumerations


: AutoFormattingFlag

Enumerated values for auto formatting.

Since:

  • 4.9.3.93
  • AutoNone - Do not perform any automatic formatting.
  • AutoBulletList - Only automatically format bullet lists.
  • AutoAll - Apply all available auto-formatting.

—–

: LineWrapMode

Enumerated values for how lines should wrap.

Since:

  • 4.9.3.93
  • NoLineWrap - Do not wrap the text.
  • WidgetWidth - Wrap the text at the current width of the widget.
  • FixedPixelWidth - Wrap the text at a fixed number of pixels from the widget's left side.
  • FixedColumnWidth - Wrap the text at a fixed number of character columns from the widget's left side.

—–

: WrapMode

Enumerated values for how characters in a word should wrap.

Since:

  • 4.9.3.93
  • NoWrap - Do not wrap the text at all.
  • WordWrap - Wrap the text at word boundaries.
  • ManualWrap - Same as NoWrap.
  • WrapAnywhere - Wrap the text at any point on a line, even if it occurs in the middle of a word.
  • WrapAtWordBoundaryOrAnywhere - If possible, WordWrap, otherwise WrapAnywhere.

Properties


Boolean : acceptRichText

Holds whether or not the text edit accepts rich text insertions by the user.

Since:

  • 4.9.3.93

AutoFormattingFlag : autoFormatting

Holds the enabled set of auto formatting features.

Since:

  • 4.9.3.93

Number : blockCount

Holds the number of text blocks (e.g., paragraphs) in the document. (Read Only)


Boolean : bold

Holds whether or not the font of the current format is bold.


Number : characterCount

Holds the number of characters in the text. (Read Only)

Since:

  • 4.9.3.93

Number : cursorWidth

Holds the width of the cursor in pixels.

Since:

  • 4.9.3.93

String : documentTitle

Holds the title of the document.


String : family

Holds the font family of the current format.

Since:

  • 4.9.3.93

Font : font

Holds the font of the current format.

Since:

  • 4.9.3.93

String : html

Holds the editor's contents as HTML.

Since:

  • 4.9.3.93

Boolean : italic

Holds whether or not the font of the current format is italic.


Number : lineCount

Holds the number of lines in the text. (Read Only)

Since:

  • 4.9.3.93

Number : lineWrapColumnOrWidth

Holds the position (in pixels or columns depending on the lineWrapMode) where text will be wrapped.

Since:

  • 4.9.3.93

LineWrapMode : lineWrapMode

Holds the mode the editor will use when wrapping text within words.

Since:

  • 4.9.3.93

Boolean : modified

Holds whether or not the text in the editor has been modified.

Since:

  • 4.9.3.93

Boolean : overwriteMode

Holds whether or not text entered by the user will overwrite existing text.

Since:

  • 4.9.3.93

String : plainText

Holds the editor's contents as plain text.

Since:

  • 4.9.3.93

Number : pointSize

Holds the point size of the font of the current format.


Boolean : readOnly

Holds whether or not the text in the editor can be edited by the user.

Since:

  • 4.9.3.93

Boolean : redoAvailable

Holds whether or not a redo operation is available. (Read Only)

Since:

  • 4.9.3.93

String : selectedText

Holds the selected text (if any) of the editor.

Since:

  • 4.9.3.93

Boolean : tabChangesFocus

Holds whether or not pressing the Tab key changes focus or is accepted as input.

Since:

  • 4.9.3.93

Number : tabStopWidth

Holds the tab stop width in pixels; default is 80.

Since:

  • 4.9.3.93

String : text

Holds the text of the editor.


Color : textBackgroundColor

Holds the text background color of the current format.

Since:

  • 4.9.3.93

Color : textColor

Holds the text color of the current format.

Since:

  • 4.9.3.93

DzWidget::TextInteractionFlags : textInteractionFlags

Holds the value that is used to determine how the label reacts to user input.

Since:

  • 4.9.3.93

Boolean : underline

Holds whether or not the font of the current format is underlined.


Boolean : undoAvailable

Holds whether or not an undo operation is available. (Read Only)

Since:

  • 4.9.3.93

Boolean : undoRedoEnabled

Holds whether or not undo and redo are enabled.

Since:

  • 4.9.3.93

Number : weight

Holds the font weight of the current format. 25 = Light, 50 = Normal, 63 = DemiBold, 75 = Bold, 87 = Black.

Since:

  • 4.9.3.93

WrapMode : wordWrapMode

Holds the mode the editor will use when wrapping text by words.

Since:

  • 4.9.3.93

Constructors


DzTextEdit( DzWidget parent )

Creates a text edit widget as a child of the given parent widget.

Parameter(s):

  • parent - The widget parent for the text edit.

Methods


String : anchorAt( Point pos )

Parameter(s):

  • pos - The position to get the anchor at.

Return Value:

  • The name of the anchor at position pos, or an empty string if no anchor exists at that point.

Since:

  • 4.9.3.93

void : append( String text )

Adds text as a new paragraph to the end of the editor.

Parameter(s):

  • text - The text to add.

Since:

  • 4.9.3.93

void : backspace()

If text is currently selected, it will be deleted and the cursor moved to the beginning of the selection. If no text is selected, the cursor will be moved one character to the left and the character will be deleted.

Since:

  • 4.9.3.93

void : backspaceWord()

If a word is currently selected, it will be deleted and the cursor moved to the beginning of the selection. If no word is selected, the cursor will be moved one word to the left and the word will be deleted.

Since:

  • 4.9.3.93

void : clear()

Removes all text from the editor.

Since:

  • 4.9.3.93

void : copy()

Copies the selected text into the clipboard.

Since:

  • 4.9.3.93

void : cursorBackward( Boolean mark=false, Number steps=1 )

Moves the cursor backward the given number of characters.

Parameter(s):

  • mark - If true, each character that is stepped over will be added to the current selection.
  • steps - The number of characters to move the cursor.

Since:

  • 4.9.3.93

void : cursorForward( Boolean mark=false, Number steps=1 )

Moves the cursor forward the given number of characters.

Parameter(s):

  • mark - If true, each character that is stepped over will be added to the current selection.
  • steps - The number of characters to move the cursor.

Since:

  • 4.9.3.93

void : cursorWordBackward( Boolean mark=false, Number steps=1 )

Moves the cursor backward one word.

Parameter(s):

  • mark - If true, the word will be added to the current selection.
  • steps - The number of words to move the cursor.

Since:

  • 4.9.3.93

void : cursorWordForward( Boolean mark=false, Number steps=1 )

Moves the cursor forward one word.

Parameter(s):

  • mark - If true, the word will be added to the current selection.
  • steps - The number of words to move the cursor.

Since:

  • 4.9.3.93

void : cut()

Copies the selected text into the clipboard, and removes it from the editor.

Since:

  • 4.9.3.93

void : del()

If text is currently selected, it will be deleted and the cursor moved to the beginning of the selection. If no text is selected, the character to the right of the cursor will be deleted.

Since:

  • 4.9.3.93

void : deleteWord()

If a word is currently selected, it will be deleted and the cursor moved to the beginning of the selection. If no word is selected, the word to the right of the cursor will be deleted.

Since:

  • 4.9.3.93

void : down( Boolean mark=false, Number steps=1 )

Moves the cursor to the line below the current line.

Parameter(s):

  • mark - If true, the text from the position of the cursor in the line below the current line to the cursor's previous position will be added to the current selection.
  • steps - The number of lines to move the cursor.

Since:

  • 4.9.3.93

void : end( Boolean mark=false )

Moves the cursor to the end of the document.

Parameter(s):

  • mark - If true, the text from the cursor's previous position to the end of the document will be added to the current selection.

Since:

  • 4.9.3.93

void : ensureCursorVisible()

Ensures that the cursor is visible by scrolling the editor if necessary.

Since:

  • 4.9.3.93

Boolean : find( String expression, Boolean caseSensitive=false, Boolean wholeWord=false, Boolean backward=false )

Finds the next occurrence of expression using the given options and changes the cursor to select the match.

Parameter(s):

  • expression - The expression to find.
  • caseSensitive - If true, the search is case sensitive.
  • wholeWord - If true, the search looks for whole words.
  • backward - If true, the search is performed in the reverse direction.

Return Value:

  • true if expression was found, otherwise false.

Since:

  • 4.9.3.93

Boolean : hasSelectedText()

Return Value:

  • true if text is selected, otherwise false.

void : home( Boolean mark=false )

Moves the cursor to the beginning of the document.

Parameter(s):

  • mark - If true, the text from the beginning of the document to the cursor's previous position will be added to the current selection.

Since:

  • 4.9.3.93

void : insertBlock()

Splits the block (paragraph) at the cursor position.

Since:

  • 4.9.3.93

void : insertHtml( String text )

Inserts text, which is assumed to be HTML formatted, at the current cursor position.

Parameter(s):

  • text - The HTML formatted text to insert.

Since:

  • 4.9.3.93

void : insertPlainText( String text )

Inserts text at the current cursor position.

Parameter(s):

  • text - The text to insert.

Since:

  • 4.9.3.93

void : lineEnd( Boolean mark=false )

Moves the cursor to the end of the line.

Parameter(s):

  • mark - If true, the text from the cursor's previous position to the end of the line will be added to the current selection.

Since:

  • 4.9.3.93

void : lineStart( Boolean mark=false )

Moves the cursor to the beginning of the line.

Parameter(s):

  • mark - If true, the text from the beginning of the line to the cursor's previous position will be added to the current selection.

Since:

  • 4.9.3.93

void : pageDown( Boolean mark=false )

Moves the cursor a page down in the document.

Parameter(s):

  • mark - If true, the text from the cursor's previous position to a page down in the document will be added to the current selection.

Since:

  • 4.9.3.93

void : pageUp( Boolean mark=false )

Moves the cursor a page up in the document.

Parameter(s):

  • mark - If true, the text from a page up in the document to the cursor's previous position will be added to the current selection.

Since:

  • 4.9.3.93

void : paste()

Inserts any text on the clipboard into the line at the cursor's current position.

Since:

  • 4.9.3.93

void : redo()

If redoAvailable is true, redoes the next operation in the editor.

Since:

  • 4.9.3.93

void : scrollToAnchor( String name )

Scrolls the editor to make the text at the anchor name visible, if it can be found in the document. If the anchor isn't found no scrolling will occur. An anchor is defined using the HTML anchor tag, e.g., <a name=“target”>.

Parameter(s):

  • name - The name of the anchor to scroll to.

Since:

  • 4.9.3.93

void : selectAll()

Selects all the text in the editor.

Since:

  • 4.9.3.93

String : selectedText()

Return Value:

  • The selected text (if any), or an empty string.

Number : selectionEnd()

Return Value:

  • The character position at which the current selection ends.

Number : selectionStart()

Return Value:

  • The character position at which the current selection begins.

String : text( Number blockIdx )

Parameter(s):

  • blockIdx - The index of the block to get the text of.

Return Value:

  • If blockIdx is in range, the text of the block at blockIdx, otherwise an empty string.

void : undo()

If undoAvailable is true, undoes the last operation in the editor.

Since:

  • 4.9.3.93

void : up( Boolean mark=false, Number steps=1 )

Moves the cursor to the line above the current line.

Parameter(s):

  • mark - If true, the text from the position of the cursor in the line above the current line to the cursor's previous position will be added to the current selection.
  • steps - The number of lines to move the cursor.

Since:

  • 4.9.3.93

void : zoomIn( Number range=1 )

Zooms in on the text by making the base font size range points larger and recalculating all font sizes to be the new size.

Parameter(s):

  • range - The number of points to increase the fonts sizes by.

Since:

  • 4.9.3.93

void : zoomOut( Number range=1 )

Zooms out on the text by making the base font size range points smaller and recalculating all font sizes to be the new size.

Parameter(s):

  • range - The number of points to decrease the fonts sizes by.

Since:

  • 4.9.3.93

Signals


void : copyAvailable( Boolean yesNo )

Signature:“copyAvailable(bool)”

Emitted when text is selected or de-selected in the editor.


void : cursorPositionChanged()

Signature:“cursorPositionChanged()”

Emitted when the position of the cursor has changed.


void : redoAvailable( Boolean yesNo )

Signature:“redoAvailable(bool)”

Emitted when the availability of redo changes. If yesNo is true, redo() will work until redoAvailable(false) is next emitted.


void : selectionChanged()

Signature:“selectionChanged()”

Emitted when the selection changes.


void : textChanged()

Signature:“textChanged()”

Emitted when the text in the editor changes.


void : undoAvailable( Boolean yesNo )

Signature:“undoAvailable(bool)”

Emitted when the availability of undo changes. If yesNo is true, undo() will work until undoAvailable(false) is next emitted.