Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Wiki Markup
{alias:qtextedit}

Name

qtextedit — multiline text editor

...

The qtextedit command creates a QTextEdit object. This is a multiline text editor in which the user may edit text interactively or programmatically. To set the contents of the editor use the qsettext command. To append text use qappend. To retrieve the text use qtext. The editor contents may be cleared using qclear.

Arguments

None

Examples

Ex.1: QTextEdit

...

No Format
bgColor#eeeeee
borderWidth1

# Create toplevel window 
set w [qwidget ]
qsetwindowtitle QTextEdit

# Create editor and insert/retrieve text
qvboxlayout {
	set editor [qtextedit]
	qsettext $editor "Hello World"
	qappend $editor "Appending text is easy"

	# Get text and assign to Tcl variable
	set text [qtext $editor]
	puts $text
}

qshow $w

...

Example QTextEdit shows a QTextEdit with text added using the qsettext and qappend commands.

Ex.2: Editor with clear button

...

No Format
bgColor#eeeeee
borderWidth1

set w [qwidget]
qsetwindowtitle "Editor"
qvboxlayout {
     set editor [qtextedit]
     qpushbutton Clear "qclear $editor"
}
qshow $w

...

Example Editor with clear button illustrates use of the qclear command. Pressing the Clear button will clear the textual contents of the editor.