<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qmultilineedit.cpp:54 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>TQMultiLineEdit Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQMultiLineEdit Class Reference<br><small>[obsolete]</small></h1> <p>The TQMultiLineEdit widget is a simple editor for inputting text. <a href="#details">More...</a> <p><tt>#include <<a href="qmultilineedit-h.html">ntqmultilineedit.h</a>></tt> <p>Inherits <a href="tqtextedit.html">TQTextEdit</a>. <p><a href="qmultilineedit-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn><a href="#TQMultiLineEdit"><b>TQMultiLineEdit</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li> <li class=fn>TQString <a href="#textLine"><b>textLine</b></a> ( int line ) const</li> <li class=fn>int <a href="#numLines"><b>numLines</b></a> () const</li> <li class=fn>virtual void <a href="#insertLine"><b>insertLine</b></a> ( const TQString & txt, int line = -1 )</li> <li class=fn>virtual void <a href="#insertAt"><b>insertAt</b></a> ( const TQString & s, int line, int col, bool mark )</li> <li class=fn>virtual void <a href="#removeLine"><b>removeLine</b></a> ( int paragraph )</li> <li class=fn>virtual void <a href="#setCursorPosition"><b>setCursorPosition</b></a> ( int line, int col, bool mark )</li> <li class=fn>bool <a href="#atBeginning"><b>atBeginning</b></a> () const</li> <li class=fn>bool <a href="#atEnd"><b>atEnd</b></a> () const</li> <li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int flags )</li> <li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li> <li class=fn>void <a href="#setEdited"><b>setEdited</b></a> ( bool )</li> <li class=fn>bool <a href="#edited"><b>edited</b></a> () const</li> <li class=fn>bool <a href="#hasMarkedText"><b>hasMarkedText</b></a> () const</li> <li class=fn>TQString <a href="#markedText"><b>markedText</b></a> () const</li> <li class=fn>void <a href="#cursorWordForward"><b>cursorWordForward</b></a> ( bool mark )</li> <li class=fn>void <a href="#cursorWordBackward"><b>cursorWordBackward</b></a> ( bool mark )</li> <li class=fn>bool autoUpdate () const <em>(obsolete)</em></li> <li class=fn>virtual void setAutoUpdate ( bool ) <em>(obsolete)</em></li> <li class=fn>int totalWidth () const <em>(obsolete)</em></li> <li class=fn>int totalHeight () const <em>(obsolete)</em></li> <li class=fn>int maxLines () const <em>(obsolete)</em></li> <li class=fn>void setMaxLines ( int ) <em>(obsolete)</em></li> </ul> <h2>Public Slots</h2> <ul> <li class=fn>void deselect () <em>(obsolete)</em></li> </ul> <h2>Properties</h2> <ul> <li class=fn>Alignment <a href="#alignment-prop"><b>alignment</b></a> - the editor's paragraph alignment</li> <li class=fn>bool <a href="#atBeginning-prop"><b>atBeginning</b></a> - whether the cursor is placed at the beginning of the text <em>(read only)</em></li> <li class=fn>bool <a href="#atEnd-prop"><b>atEnd</b></a> - whether the cursor is placed at the end of the text <em>(read only)</em></li> <li class=fn>bool <a href="#edited-prop"><b>edited</b></a> - whether the document has been edited by the user</li> <li class=fn>int <a href="#numLines-prop"><b>numLines</b></a> - the number of paragraphs in the editor <em>(read only)</em></li> </ul> <h2>Protected Members</h2> <ul> <li class=fn>TQPoint <a href="#cursorPoint"><b>cursorPoint</b></a> () const</li> <li class=fn>virtual void <a href="#insertAndMark"><b>insertAndMark</b></a> ( const TQString & str, bool mark )</li> <li class=fn>virtual void <a href="#newLine"><b>newLine</b></a> ()</li> <li class=fn>virtual void <a href="#killLine"><b>killLine</b></a> ()</li> <li class=fn>virtual void <a href="#pageUp"><b>pageUp</b></a> ( bool mark = FALSE )</li> <li class=fn>virtual void <a href="#pageDown"><b>pageDown</b></a> ( bool mark = FALSE )</li> <li class=fn>virtual void <a href="#cursorLeft"><b>cursorLeft</b></a> ( bool mark = FALSE, bool wrap = TRUE )</li> <li class=fn>virtual void <a href="#cursorRight"><b>cursorRight</b></a> ( bool mark = FALSE, bool wrap = TRUE )</li> <li class=fn>virtual void <a href="#cursorUp"><b>cursorUp</b></a> ( bool mark = FALSE )</li> <li class=fn>virtual void <a href="#cursorDown"><b>cursorDown</b></a> ( bool mark = FALSE )</li> <li class=fn>virtual void <a href="#backspace"><b>backspace</b></a> ()</li> <li class=fn>virtual void <a href="#home"><b>home</b></a> ( bool mark = FALSE )</li> <li class=fn>virtual void <a href="#end"><b>end</b></a> ( bool mark = FALSE )</li> <li class=fn>bool <a href="#getMarkedRegion"><b>getMarkedRegion</b></a> ( int * line1, int * col1, int * line2, int * col2 ) const</li> <li class=fn>int <a href="#lineLength"><b>lineLength</b></a> ( int row ) const</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> <b>This class is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> The TQMultiLineEdit widget is a simple editor for inputting text. <p> <p> The TQMultiLineEdit was a simple editor widget in former TQt versions. TQt 3.0 includes a new richtext engine which obsoletes TQMultiLineEdit. It is still included for compatibility reasons. It is now a subclass of <a href="tqtextedit.html">TQTextEdit</a>, and provides enough of the old TQMultiLineEdit API to keep old applications working. <p> If you implement something new with TQMultiLineEdit, we suggest using <a href="tqtextedit.html">TQTextEdit</a> instead and call <a href="tqtextedit.html#setTextFormat">TQTextEdit::setTextFormat</a>(TQt::PlainText). <p> Although most of the old TQMultiLineEdit API is still available, there is a few difference. The old TQMultiLineEdit operated on lines, not on paragraphs. As lines change all the time during wordwrap, the new richtext engine uses paragraphs as basic elements in the data structure. All functions (<a href="#numLines">numLines</a>(), <a href="#textLine">textLine</a>(), etc.) that operated on lines, now operate on paragraphs. Further, getString() has been removed completely. It revealed too much of the internal data structure. <p> Applications which made normal and reasonable use of TQMultiLineEdit should still work without problems. Some odd usage will require some porting. In these cases, it may be better to use <a href="tqtextedit.html">TQTextEdit</a> now. <p> <img src=qmlined-m.png> <img src=qmlined-w.png> <p> <p>See also <a href="tqtextedit.html">TQTextEdit</a> and <a href="advanced.html">Advanced Widgets</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="TQMultiLineEdit"></a>TQMultiLineEdit::TQMultiLineEdit ( <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs a new, empty, TQMultiLineEdit with parent <em>parent</em> called <em>name</em>. <h3 class=fn>int <a name="alignment"></a>TQMultiLineEdit::alignment () const </h3><p>Returns the editor's paragraph alignment. See the <a href="ntqmultilineedit.html#alignment-prop">"alignment"</a> property for details. <h3 class=fn>bool <a name="atBeginning"></a>TQMultiLineEdit::atBeginning () const </h3><p>Returns TRUE if the cursor is placed at the beginning of the text; otherwise returns FALSE. See the <a href="ntqmultilineedit.html#atBeginning-prop">"atBeginning"</a> property for details. <h3 class=fn>bool <a name="atEnd"></a>TQMultiLineEdit::atEnd () const </h3><p>Returns TRUE if the cursor is placed at the end of the text; otherwise returns FALSE. See the <a href="ntqmultilineedit.html#atEnd-prop">"atEnd"</a> property for details. <h3 class=fn>bool <a name="autoUpdate"></a>TQMultiLineEdit::autoUpdate () const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <h3 class=fn>void <a name="backspace"></a>TQMultiLineEdit::backspace ()<tt> [virtual protected]</tt> </h3> Deletes the character on the left side of the text cursor and moves the cursor one position to the left. If a text has been selected by the user (e.g. by clicking and dragging) the cursor is put at the beginning of the selected text and the selected text is removed. <a href="tqtextedit.html#del">del</a>() <h3 class=fn>void <a name="cursorDown"></a>TQMultiLineEdit::cursorDown ( bool mark = FALSE )<tt> [virtual protected]</tt> </h3> Moves the cursor one line down. If <em>mark</em> is TRUE, the text is selected. <p>See also <a href="#cursorUp">cursorUp</a>(), <a href="#cursorLeft">cursorLeft</a>(), and <a href="#cursorRight">cursorRight</a>(). <h3 class=fn>void <a name="cursorLeft"></a>TQMultiLineEdit::cursorLeft ( bool mark = FALSE, bool wrap = TRUE )<tt> [virtual protected]</tt> </h3> Moves the cursor one character to the left. If <em>mark</em> is TRUE, the text is selected. The <em>wrap</em> parameter is currently ignored. <p> <p>See also <a href="#cursorRight">cursorRight</a>(), <a href="#cursorUp">cursorUp</a>(), and <a href="#cursorDown">cursorDown</a>(). <h3 class=fn><a href="tqpoint.html">TQPoint</a> <a name="cursorPoint"></a>TQMultiLineEdit::cursorPoint () const<tt> [protected]</tt> </h3> Returns the top center point where the cursor is drawn. <h3 class=fn>void <a name="cursorRight"></a>TQMultiLineEdit::cursorRight ( bool mark = FALSE, bool wrap = TRUE )<tt> [virtual protected]</tt> </h3> Moves the cursor one character to the right. If <em>mark</em> is TRUE, the text is selected. The <em>wrap</em> parameter is currently ignored. <p> <p>See also <a href="#cursorLeft">cursorLeft</a>(), <a href="#cursorUp">cursorUp</a>(), and <a href="#cursorDown">cursorDown</a>(). <h3 class=fn>void <a name="cursorUp"></a>TQMultiLineEdit::cursorUp ( bool mark = FALSE )<tt> [virtual protected]</tt> </h3> Moves the cursor up one line. If <em>mark</em> is TRUE, the text is selected. <p> <p>See also <a href="#cursorDown">cursorDown</a>(), <a href="#cursorLeft">cursorLeft</a>(), and <a href="#cursorRight">cursorRight</a>(). <h3 class=fn>void <a name="cursorWordBackward"></a>TQMultiLineEdit::cursorWordBackward ( bool mark ) </h3> Moves the cursor one word to the left. If <em>mark</em> is TRUE, the text is selected. <p> <p>See also <a href="#cursorWordForward">cursorWordForward</a>(). <h3 class=fn>void <a name="cursorWordForward"></a>TQMultiLineEdit::cursorWordForward ( bool mark ) </h3> Moves the cursor one word to the right. If <em>mark</em> is TRUE, the text is selected. <p> <p>See also <a href="#cursorWordBackward">cursorWordBackward</a>(). <h3 class=fn>void <a name="deselect"></a>TQMultiLineEdit::deselect ()<tt> [slot]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <h3 class=fn>bool <a name="edited"></a>TQMultiLineEdit::edited () const </h3><p>Returns TRUE if the document has been edited by the user; otherwise returns FALSE. See the <a href="ntqmultilineedit.html#edited-prop">"edited"</a> property for details. <h3 class=fn>void <a name="end"></a>TQMultiLineEdit::end ( bool mark = FALSE )<tt> [virtual protected]</tt> </h3> Moves the text cursor to the right end of the line. If <em>mark</em> is TRUE, text is selected toward the last position. If it is FALSE and the cursor is moved, all selected text is unselected. <p> <p>See also <a href="#home">home</a>(). <h3 class=fn>bool <a name="getMarkedRegion"></a>TQMultiLineEdit::getMarkedRegion ( int * line1, int * col1, int * line2, int * col2 ) const<tt> [protected]</tt> </h3> If there is selected text, sets <em>line1</em>, <em>col1</em>, <em>line2</em> and <em>col2</em> to the start and end of the selected region and returns TRUE. Returns FALSE if there is no selected text. <h3 class=fn>bool <a name="hasMarkedText"></a>TQMultiLineEdit::hasMarkedText () const </h3> Returns TRUE if there is selected text. <h3 class=fn>void <a name="home"></a>TQMultiLineEdit::home ( bool mark = FALSE )<tt> [virtual protected]</tt> </h3> Moves the text cursor to the left end of the line. If <em>mark</em> is TRUE, text is selected toward the first position. If it is FALSE and the cursor is moved, all selected text is unselected. <p> <p>See also <a href="#end">end</a>(). <h3 class=fn>void <a name="insertAndMark"></a>TQMultiLineEdit::insertAndMark ( const <a href="tqstring.html">TQString</a> & str, bool mark )<tt> [virtual protected]</tt> </h3> Inserts <em>str</em> at the current cursor position and selects the text if <em>mark</em> is TRUE. <h3 class=fn>void <a name="insertAt"></a>TQMultiLineEdit::insertAt ( const <a href="tqstring.html">TQString</a> & s, int line, int col, bool mark )<tt> [virtual]</tt> </h3> Inserts string <em>s</em> at paragraph number <em>line</em>, after character number <em>col</em> in the paragraph. If <em>s</em> contains newline characters, new lines are inserted. If <em>mark</em> is TRUE the inserted string will be selected. <p> The cursor position is adjusted. <h3 class=fn>void <a name="insertLine"></a>TQMultiLineEdit::insertLine ( const <a href="tqstring.html">TQString</a> & txt, int line = -1 )<tt> [virtual]</tt> </h3> Inserts <em>txt</em> at paragraph number <em>line</em>. If <em>line</em> is less than zero, or larger than the number of paragraphs, the new text is put at the end. If <em>txt</em> contains newline characters, several paragraphs are inserted. <p> The cursor position is not changed. <h3 class=fn>void <a name="killLine"></a>TQMultiLineEdit::killLine ()<tt> [virtual protected]</tt> </h3> Deletes text from the current cursor position to the end of the line. (Note that this function still operates on lines, not paragraphs.) <h3 class=fn>int <a name="lineLength"></a>TQMultiLineEdit::lineLength ( int row ) const<tt> [protected]</tt> </h3> Returns the number of characters at paragraph number <em>row</em>. If <em>row</em> is out of range, -1 is returned. <h3 class=fn><a href="tqstring.html">TQString</a> <a name="markedText"></a>TQMultiLineEdit::markedText () const </h3> Returns a copy of the selected text. <h3 class=fn>int <a name="maxLines"></a>TQMultiLineEdit::maxLines () const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <h3 class=fn>void <a name="newLine"></a>TQMultiLineEdit::newLine ()<tt> [virtual protected]</tt> </h3> Splits the paragraph at the current cursor position. <h3 class=fn>int <a name="numLines"></a>TQMultiLineEdit::numLines () const </h3><p>Returns the number of paragraphs in the editor. See the <a href="ntqmultilineedit.html#numLines-prop">"numLines"</a> property for details. <h3 class=fn>void <a name="pageDown"></a>TQMultiLineEdit::pageDown ( bool mark = FALSE )<tt> [virtual protected]</tt> </h3> Moves the cursor one page down. If <em>mark</em> is TRUE, the text is selected. <h3 class=fn>void <a name="pageUp"></a>TQMultiLineEdit::pageUp ( bool mark = FALSE )<tt> [virtual protected]</tt> </h3> Moves the cursor one page up. If <em>mark</em> is TRUE, the text is selected. <h3 class=fn>void <a name="removeLine"></a>TQMultiLineEdit::removeLine ( int paragraph )<tt> [virtual]</tt> </h3> Deletes the paragraph at paragraph number <em>paragraph</em>. If <em>paragraph</em> is less than zero or larger than the number of paragraphs, nothing is deleted. <h3 class=fn>void <a name="setAlignment"></a>TQMultiLineEdit::setAlignment ( int flags )<tt> [virtual]</tt> </h3><p>Sets the editor's paragraph alignment to <em>flags</em>. See the <a href="ntqmultilineedit.html#alignment-prop">"alignment"</a> property for details. <p>Reimplemented from <a href="tqtextedit.html#setAlignment">TQTextEdit</a>. <h3 class=fn>void <a name="setAutoUpdate"></a>TQMultiLineEdit::setAutoUpdate ( bool )<tt> [virtual]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <p>Example: <a href="qwerty-example.html#x376">qwerty/qwerty.cpp</a>. <h3 class=fn>void <a name="setCursorPosition"></a>TQMultiLineEdit::setCursorPosition ( int line, int col, bool mark )<tt> [virtual]</tt> </h3> Sets the cursor position to character number <em>col</em> in paragraph number <em>line</em>. The parameters are adjusted to lie within the legal range. <p> If <em>mark</em> is FALSE, the selection is cleared. otherwise it is extended. <p> <h3 class=fn>void <a name="setEdited"></a>TQMultiLineEdit::setEdited ( bool ) </h3><p>Sets whether the document has been edited by the user. See the <a href="ntqmultilineedit.html#edited-prop">"edited"</a> property for details. <h3 class=fn>void <a name="setMaxLines"></a>TQMultiLineEdit::setMaxLines ( int ) </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <h3 class=fn><a href="tqstring.html">TQString</a> <a name="textLine"></a>TQMultiLineEdit::textLine ( int line ) const </h3> Returns the text at line number <em>line</em> (possibly the empty string), or a <a href="tqstring.html#operator!">null string</a> if <em>line</em> is invalid. <p>Example: <a href="qwerty-example.html#x377">qwerty/qwerty.cpp</a>. <h3 class=fn>int <a name="totalHeight"></a>TQMultiLineEdit::totalHeight () const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <h3 class=fn>int <a name="totalWidth"></a>TQMultiLineEdit::totalWidth () const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> <hr><h2>Property Documentation</h2> <h3 class=fn>Alignment <a name="alignment-prop"></a>alignment</h3> <p>This property holds the editor's paragraph alignment. <p>Sets the alignment to flag, which must be <a href="ntqt.html#AlignmentFlags-enum">AlignLeft</a>, <a href="ntqt.html#AlignmentFlags-enum">AlignHCenter</a> or <a href="ntqt.html#AlignmentFlags-enum">AlignRight</a>. <p> If flag is an illegal flag nothing happens. <p> <p>See also <a href="ntqt.html#AlignmentFlags-enum">TQt::AlignmentFlags</a>. <p>Set this property's value with <a href="#setAlignment">setAlignment</a>() and get this property's value with <a href="#alignment">alignment</a>(). <h3 class=fn>bool <a name="atBeginning-prop"></a>atBeginning</h3> <p>This property holds whether the cursor is placed at the beginning of the text. <p>Get this property's value with <a href="#atBeginning">atBeginning</a>(). <p><p>See also <a href="#atEnd-prop">atEnd</a>. <h3 class=fn>bool <a name="atEnd-prop"></a>atEnd</h3> <p>This property holds whether the cursor is placed at the end of the text. <p>Get this property's value with <a href="#atEnd">atEnd</a>(). <p><p>See also <a href="#atBeginning-prop">atBeginning</a>. <h3 class=fn>bool <a name="edited-prop"></a>edited</h3> <p>This property holds whether the document has been edited by the user. <p>This is the same as <a href="tqtextedit.html">TQTextEdit</a>'s "modifed" property. <p> <p>See also <a href="tqtextedit.html#modified-prop">TQTextEdit::modified</a>. <p>Set this property's value with <a href="#setEdited">setEdited</a>() and get this property's value with <a href="#edited">edited</a>(). <h3 class=fn>int <a name="numLines-prop"></a>numLines</h3> <p>This property holds the number of paragraphs in the editor. <p>The count includes any empty paragraph at top and bottom, so for an empty editor this method returns 1. <p>Get this property's value with <a href="#numLines">numLines</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">TQt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>TQt 3.3.8</div> </table></div></address></body> </html>