Wiki Markup |
---|
{alias:qtextedit}
h2. Name
*qtextedit* — multiline text editor
h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}
*qtextedit*
{panel}
h2. Description
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].
h2. Arguments
None
h2. Examples
h3. Ex.1: QTextEdit
{anchor:QTextEdit}
{noformat:|borderWidth=1|bgColor=#eeeeee}
# 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
{noformat}
!att:_img_cmd^qtextedit.png!
Example +QTextEdit+ shows a QTextEdit with text added using the [qsettext] and [qappend] commands.
h3. Ex.2: Editor with clear button
{anchor:Editor with clear button}
{noformat:|borderWidth=1|bgColor=#eeeeee}
set w [qwidget]
qsetwindowtitle "Editor"
qvboxlayout {
set editor [qtextedit]
qpushbutton Clear "qclear $editor"
}
qshow $w
{noformat}
!att:_img_cmd^qtextedit_clear.png!
Example +Editor with clear button+ illustrates use of the [qclear] command. Pressing the *Clear* button will clear the textual contents of the editor.
{pagebreak}
|
Page Comparison
General
Content
Integrations