You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
774 lines
51 KiB
774 lines
51 KiB
14 years ago
|
<!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/qlineedit.cpp:268 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QLineEdit 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>QLineEdit Class Reference</h1>
|
||
|
|
||
|
<p>The QLineEdit widget is a one-line text editor.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qlineedit-h.html">qlineedit.h</a>></tt>
|
||
|
<p>Inherits <a href="qframe.html">QFrame</a>.
|
||
|
<p><a href="qlineedit-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#QLineEdit"><b>QLineEdit</b></a> ( QWidget * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#QLineEdit-2"><b>QLineEdit</b></a> ( const QString & contents, QWidget * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#QLineEdit-3"><b>QLineEdit</b></a> ( const QString & contents, const QString & inputMask, QWidget * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#~QLineEdit"><b>~QLineEdit</b></a> ()</li>
|
||
|
<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#displayText"><b>displayText</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#maxLength"><b>maxLength</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#frame"><b>frame</b></a> () const</li>
|
||
|
<li class=fn>enum <a href="#EchoMode-enum"><b>EchoMode</b></a> { Normal, NoEcho, Password }</li>
|
||
|
<li class=fn>EchoMode <a href="#echoMode"><b>echoMode</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</li>
|
||
|
<li class=fn>const QValidator * <a href="#validator"><b>validator</b></a> () const</li>
|
||
|
<li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
|
||
|
<li class=fn>virtual QSize <a href="#minimumSizeHint"><b>minimumSizeHint</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#cursorPosition"><b>cursorPosition</b></a> () const</li>
|
||
|
<li class=fn>bool validateAndSet ( const QString & newText, int newPos, int newMarkAnchor, int newMarkDrag ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li>
|
||
|
<li class=fn>void cursorLeft ( bool mark, int steps = 1 ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>void cursorRight ( bool mark, int steps = 1 ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>void <a href="#cursorForward"><b>cursorForward</b></a> ( bool mark, int steps = 1 )</li>
|
||
|
<li class=fn>void <a href="#cursorBackward"><b>cursorBackward</b></a> ( bool mark, int steps = 1 )</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>void <a href="#backspace"><b>backspace</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#del"><b>del</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#home"><b>home</b></a> ( bool mark )</li>
|
||
|
<li class=fn>void <a href="#end"><b>end</b></a> ( bool mark )</li>
|
||
|
<li class=fn>bool <a href="#isModified"><b>isModified</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#clearModified"><b>clearModified</b></a> ()</li>
|
||
|
<li class=fn>bool edited () const <em>(obsolete)</em></li>
|
||
|
<li class=fn>void setEdited ( bool ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>bool <a href="#hasSelectedText"><b>hasSelectedText</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#selectedText"><b>selectedText</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#selectionStart"><b>selectionStart</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isUndoAvailable"><b>isUndoAvailable</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isRedoAvailable"><b>isRedoAvailable</b></a> () const</li>
|
||
|
<li class=fn>bool hasMarkedText () const <em>(obsolete)</em></li>
|
||
|
<li class=fn>QString markedText () const <em>(obsolete)</em></li>
|
||
|
<li class=fn>bool <a href="#dragEnabled"><b>dragEnabled</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#inputMask"><b>inputMask</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setInputMask"><b>setInputMask</b></a> ( const QString & inputMask )</li>
|
||
|
<li class=fn>bool <a href="#hasAcceptableInput"><b>hasAcceptableInput</b></a> () const</li>
|
||
|
<li class=fn>int characterAt ( int xpos, QChar * chr ) const <em>(obsolete)</em></li>
|
||
|
<li class=fn>bool getSelection ( int * start, int * end ) <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<h2>Public Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const QString & )</li>
|
||
|
<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#deselect"><b>deselect</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#clearValidator"><b>clearValidator</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#insert"><b>insert</b></a> ( const QString & newText )</li>
|
||
|
<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#undo"><b>undo</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#redo"><b>redo</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#setMaxLength"><b>setMaxLength</b></a> ( int )</li>
|
||
|
<li class=fn>virtual void <a href="#setFrame"><b>setFrame</b></a> ( bool )</li>
|
||
|
<li class=fn>virtual void <a href="#setEchoMode"><b>setEchoMode</b></a> ( EchoMode )</li>
|
||
|
<li class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool )</li>
|
||
|
<li class=fn>virtual void <a href="#setValidator"><b>setValidator</b></a> ( const QValidator * v )</li>
|
||
|
<li class=fn>virtual void <a href="#setSelection"><b>setSelection</b></a> ( int start, int length )</li>
|
||
|
<li class=fn>virtual void <a href="#setCursorPosition"><b>setCursorPosition</b></a> ( int )</li>
|
||
|
<li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int flag )</li>
|
||
|
<li class=fn>virtual void <a href="#cut"><b>cut</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#copy"><b>copy</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#paste"><b>paste</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#setDragEnabled"><b>setDragEnabled</b></a> ( bool b )</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ( const QString & )</li>
|
||
|
<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#lostFocus"><b>lostFocus</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<li class=fn>bool <a href="#acceptableInput-prop"><b>acceptableInput</b></a> - whether the input satisfies the inputMask and the validator <em>(read only)</em></li>
|
||
|
<li class=fn>Alignment <a href="#alignment-prop"><b>alignment</b></a> - the alignment of the line edit</li>
|
||
|
<li class=fn>int <a href="#cursorPosition-prop"><b>cursorPosition</b></a> - the current cursor position for this line edit</li>
|
||
|
<li class=fn>QString <a href="#displayText-prop"><b>displayText</b></a> - the displayed text <em>(read only)</em></li>
|
||
|
<li class=fn>bool <a href="#dragEnabled-prop"><b>dragEnabled</b></a> - whether the lineedit starts a drag if the user presses and moves the mouse on some selected text</li>
|
||
|
<li class=fn>EchoMode <a href="#echoMode-prop"><b>echoMode</b></a> - the line edit's echo mode</li>
|
||
|
<li class=fn>bool edited - whether the line edit has been edited. Use modified instead <em>(obsolete)</em></li>
|
||
|
<li class=fn>bool <a href="#frame-prop"><b>frame</b></a> - whether the line edit draws itself with a frame</li>
|
||
|
<li class=fn>bool hasMarkedText - whether part of the text has been selected by the user. Use hasSelectedText instead <em>(read only)</em> <em>(obsolete)</em></li>
|
||
|
<li class=fn>bool <a href="#hasSelectedText-prop"><b>hasSelectedText</b></a> - whether there is any text selected <em>(read only)</em></li>
|
||
|
<li class=fn>QString <a href="#inputMask-prop"><b>inputMask</b></a> - the validation input mask</li>
|
||
|
<li class=fn>QString markedText - the text selected by the user. Use selectedText instead <em>(read only)</em> <em>(obsolete)</em></li>
|
||
|
<li class=fn>int <a href="#maxLength-prop"><b>maxLength</b></a> - the maximum permitted length of the text</li>
|
||
|
<li class=fn>bool <a href="#modified-prop"><b>modified</b></a> - whether the line edit's contents has been modified by the user <em>(read only)</em></li>
|
||
|
<li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a> - whether the line edit is read only</li>
|
||
|
<li class=fn>bool <a href="#redoAvailable-prop"><b>redoAvailable</b></a> - whether redo is available <em>(read only)</em></li>
|
||
|
<li class=fn>QString <a href="#selectedText-prop"><b>selectedText</b></a> - the selected text <em>(read only)</em></li>
|
||
|
<li class=fn>QString <a href="#text-prop"><b>text</b></a> - the line edit's text</li>
|
||
|
<li class=fn>bool <a href="#undoAvailable-prop"><b>undoAvailable</b></a> - whether undo is available <em>(read only)</em></li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( QKeyEvent * e )</li>
|
||
|
<li class=fn>virtual QPopupMenu * <a href="#createPopupMenu"><b>createPopupMenu</b></a> ()</li>
|
||
|
<li class=fn>void repaintArea ( int from, int to ) <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The QLineEdit widget is a one-line text editor.
|
||
|
<p>
|
||
|
|
||
|
<p> A line edit allows the user to enter and edit a single line of
|
||
|
plain text with a useful collection of editing functions,
|
||
|
including undo and redo, cut and paste, and drag and drop.
|
||
|
<p> By changing the <a href="#echoMode">echoMode</a>() of a line edit, it can also be used as
|
||
|
a "write-only" field, for inputs such as passwords.
|
||
|
<p> The length of the text can be constrained to <a href="#maxLength">maxLength</a>(). The text
|
||
|
can be arbitrarily constrained using a <a href="#validator">validator</a>() or an
|
||
|
<a href="#inputMask">inputMask</a>(), or both.
|
||
|
<p> A related class is <a href="qtextedit.html">QTextEdit</a> which allows multi-line, rich-text
|
||
|
editing.
|
||
|
<p> You can change the text with <a href="#setText">setText</a>() or <a href="#insert">insert</a>(). The text is
|
||
|
retrieved with <a href="#text">text</a>(); the displayed text (which may be different,
|
||
|
see <a href="#EchoMode-enum">EchoMode</a>) is retrieved with <a href="#displayText">displayText</a>(). Text can be
|
||
|
selected with <a href="#setSelection">setSelection</a>() or <a href="#selectAll">selectAll</a>(), and the selection can
|
||
|
be <a href="#cut">cut</a>(), <a href="#copy">copy</a>()ied and <a href="#paste">paste</a>()d. The text can be aligned with
|
||
|
<a href="#setAlignment">setAlignment</a>().
|
||
|
<p> When the text changes the <a href="#textChanged">textChanged</a>() signal is emitted; when
|
||
|
the Return or Enter key is pressed the <a href="#returnPressed">returnPressed</a>() signal is
|
||
|
emitted. Note that if there is a validator set on the line edit,
|
||
|
the returnPressed() signal will only be emitted if the validator
|
||
|
returns <tt>Acceptable</tt>.
|
||
|
<p> By default, QLineEdits have a frame as specified by the Windows
|
||
|
and <a href="motif-extension.html#Motif">Motif</a> style guides; you can turn it off by calling
|
||
|
<a href="#setFrame">setFrame</a>(FALSE).
|
||
|
<p> The default key bindings are described below. The line edit also
|
||
|
provides a context menu (usually invoked by a right mouse click)
|
||
|
that presents some of these editing options.
|
||
|
<a name="desc"></a>
|
||
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
||
|
<tr bgcolor="#a2c511"> <th valign="top">Keypress <th valign="top">Action
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Left Arrow <td valign="top">Moves the cursor one character to the left.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Shift+Left Arrow <td valign="top">Moves and selects text one character to the left.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Right Arrow <td valign="top">Moves the cursor one character to the right.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Shift+Right Arrow <td valign="top">Moves and selects text one character to the right.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Home <td valign="top">Moves the cursor to the beginning of the line.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">End <td valign="top">Moves the cursor to the end of the line.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Backspace <td valign="top">Deletes the character to the left of the cursor.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Backspace <td valign="top">Deletes the word to the left of the cursor.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Delete <td valign="top">Deletes the character to the right of the cursor.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Delete <td valign="top">Deletes the word to the right of the cursor.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+A <td valign="top">Moves the cursor to the beginning of the line.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+B <td valign="top">Moves the cursor one character to the left.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+C <td valign="top">Copies the selected text to the clipboard.
|
||
|
(Windows also supports Ctrl+Insert for this operation.)
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+D <td valign="top">Deletes the character to the right of the cursor.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+E <td valign="top">Moves the cursor to the end of the line.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+F <td valign="top">Moves the cursor one character to the right.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+H <td valign="top">Deletes the character to the left of the cursor.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+K <td valign="top">Deletes to the end of the line.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+V <td valign="top">Pastes the clipboard text into line edit.
|
||
|
(Windows also supports Shift+Insert for this operation.)
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+X <td valign="top">Deletes the selected text and copies it to the clipboard.
|
||
|
(Windows also supports Shift+Delete for this operation.)
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+Z <td valign="top">Undoes the last operation.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Y <td valign="top">Redoes the last undone operation.
|
||
|
</table></center>
|
||
|
<p> Any other key sequence that represents a valid character, will
|
||
|
cause the character to be inserted into the line edit.
|
||
|
<p> <img src=qlined-m.png> <img src=qlined-w.png>
|
||
|
<p> <p>See also <a href="qtextedit.html">QTextEdit</a>, <a href="qlabel.html">QLabel</a>, <a href="qcombobox.html">QComboBox</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Field, Entry</a>, and <a href="basic.html">Basic Widgets</a>.
|
||
|
|
||
|
<hr><h2>Member Type Documentation</h2>
|
||
|
<h3 class=fn><a name="EchoMode-enum"></a>QLineEdit::EchoMode</h3>
|
||
|
|
||
|
<p> This enum type describes how a line edit should display its
|
||
|
contents.
|
||
|
<ul>
|
||
|
<li><tt>QLineEdit::Normal</tt> - Display characters as they are entered. This is the
|
||
|
default.
|
||
|
<li><tt>QLineEdit::NoEcho</tt> - Do not display anything. This may be appropriate
|
||
|
for passwords where even the length of the
|
||
|
password should be kept secret.
|
||
|
<li><tt>QLineEdit::Password</tt> - Display asterisks instead of the characters
|
||
|
actually entered.
|
||
|
</ul><p> <p>See also <a href="#echoMode-prop">echoMode</a> and <a href="#echoMode-prop">echoMode</a>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="QLineEdit"></a>QLineEdit::QLineEdit ( <a href="qwidget.html">QWidget</a> * parent, const char * name = 0 )
|
||
|
</h3>
|
||
|
Constructs a line edit with no text.
|
||
|
<p> The maximum text length is set to 32767 characters.
|
||
|
<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
|
||
|
<p> <p>See also <a href="#text-prop">text</a> and <a href="#maxLength-prop">maxLength</a>.
|
||
|
|
||
|
<h3 class=fn><a name="QLineEdit-2"></a>QLineEdit::QLineEdit ( const <a href="qstring.html">QString</a> & contents, <a href="qwidget.html">QWidget</a> * parent, const char * name = 0 )
|
||
|
</h3>
|
||
|
Constructs a line edit containing the text <em>contents</em>.
|
||
|
<p> The cursor position is set to the end of the line and the maximum
|
||
|
text length to 32767 characters.
|
||
|
<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a>
|
||
|
constructor.
|
||
|
<p> <p>See also <a href="#text-prop">text</a> and <a href="#maxLength-prop">maxLength</a>.
|
||
|
|
||
|
<h3 class=fn><a name="QLineEdit-3"></a>QLineEdit::QLineEdit ( const <a href="qstring.html">QString</a> & contents, const <a href="qstring.html">QString</a> & inputMask, <a href="qwidget.html">QWidget</a> * parent, const char * name = 0 )
|
||
|
</h3>
|
||
|
Constructs a line edit with an input <em>inputMask</em> and the text <em>contents</em>.
|
||
|
<p> The cursor position is set to the end of the line and the maximum
|
||
|
text length is set to the length of the mask (the number of mask
|
||
|
characters and separators).
|
||
|
<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a>
|
||
|
constructor.
|
||
|
<p> <p>See also <a href="qwidget.html#setMask">setMask</a>() and <a href="#text-prop">text</a>.
|
||
|
|
||
|
<h3 class=fn><a name="~QLineEdit"></a>QLineEdit::~QLineEdit ()
|
||
|
</h3>
|
||
|
Destroys the line edit.
|
||
|
|
||
|
<h3 class=fn>int <a name="alignment"></a>QLineEdit::alignment () const
|
||
|
</h3><p>Returns the alignment of the line edit.
|
||
|
See the <a href="qlineedit.html#alignment-prop">"alignment"</a> property for details.
|
||
|
<h3 class=fn>void <a name="backspace"></a>QLineEdit::backspace ()
|
||
|
</h3>
|
||
|
If no text is selected, deletes the character to the left of the
|
||
|
text cursor and moves the cursor one position to the left. If any
|
||
|
text is selected, the cursor is moved to the beginning of the
|
||
|
selected text and the selected text is deleted.
|
||
|
<p> <p>See also <a href="#del">del</a>().
|
||
|
|
||
|
<h3 class=fn>int <a name="characterAt"></a>QLineEdit::characterAt ( int xpos, <a href="qchar.html">QChar</a> * chr ) 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="clear"></a>QLineEdit::clear ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Clears the contents of the line edit.
|
||
|
|
||
|
<h3 class=fn>void <a name="clearModified"></a>QLineEdit::clearModified ()
|
||
|
</h3>
|
||
|
Resets the modified flag to FALSE.
|
||
|
<p> <p>See also <a href="#modified-prop">modified</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="clearValidator"></a>QLineEdit::clearValidator ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
This slot is equivalent to <a href="#setValidator">setValidator</a>(0).
|
||
|
|
||
|
<h3 class=fn>void <a name="copy"></a>QLineEdit::copy () const<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Copies the selected text to the clipboard, if there is any, and if
|
||
|
<a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>.
|
||
|
<p> <p>See also <a href="#cut">cut</a>() and <a href="#paste">paste</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a> * <a name="createPopupMenu"></a>QLineEdit::createPopupMenu ()<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
This function is called to create the popup menu which is shown
|
||
|
when the user clicks on the line edit with the right mouse button.
|
||
|
If you want to create a custom popup menu, reimplement this
|
||
|
function and return the popup menu you create. The popup menu's
|
||
|
ownership is transferred to the caller.
|
||
|
|
||
|
<h3 class=fn>void <a name="cursorBackward"></a>QLineEdit::cursorBackward ( bool mark, int steps = 1 )
|
||
|
</h3>
|
||
|
Moves the cursor back <em>steps</em> characters. If <em>mark</em> is TRUE each
|
||
|
character moved over is added to the selection; if <em>mark</em> is
|
||
|
FALSE the selection is cleared.
|
||
|
<p> <p>See also <a href="#cursorForward">cursorForward</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="cursorForward"></a>QLineEdit::cursorForward ( bool mark, int steps = 1 )
|
||
|
</h3>
|
||
|
Moves the cursor forward <em>steps</em> characters. If <em>mark</em> is TRUE
|
||
|
each character moved over is added to the selection; if <em>mark</em> is
|
||
|
FALSE the selection is cleared.
|
||
|
<p> <p>See also <a href="#cursorBackward">cursorBackward</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="cursorLeft"></a>QLineEdit::cursorLeft ( bool mark, int steps = 1 )
|
||
|
</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>
|
||
|
For compatibilty with older applications only. Use <a href="#cursorBackward">cursorBackward</a>()
|
||
|
instead.
|
||
|
<p>See also <a href="#cursorBackward">cursorBackward</a>().
|
||
|
|
||
|
<h3 class=fn>int <a name="cursorPosition"></a>QLineEdit::cursorPosition () const
|
||
|
</h3><p>Returns the current cursor position for this line edit.
|
||
|
See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.
|
||
|
<h3 class=fn>void <a name="cursorRight"></a>QLineEdit::cursorRight ( bool mark, int steps = 1 )
|
||
|
</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> Use <a href="#cursorForward">cursorForward</a>() instead.
|
||
|
<p> <p>See also <a href="#cursorForward">cursorForward</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="cursorWordBackward"></a>QLineEdit::cursorWordBackward ( bool mark )
|
||
|
</h3>
|
||
|
Moves the cursor one word backward. If <em>mark</em> is TRUE, the word
|
||
|
is also selected.
|
||
|
<p> <p>See also <a href="#cursorWordForward">cursorWordForward</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="cursorWordForward"></a>QLineEdit::cursorWordForward ( bool mark )
|
||
|
</h3>
|
||
|
Moves the cursor one word forward. If <em>mark</em> is TRUE, the word is
|
||
|
also selected.
|
||
|
<p> <p>See also <a href="#cursorWordBackward">cursorWordBackward</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="cut"></a>QLineEdit::cut ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Copies the selected text to the clipboard and deletes it, if there
|
||
|
is any, and if <a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>.
|
||
|
<p> If the current validator disallows deleting the selected text,
|
||
|
<a href="#cut">cut</a>() will copy without deleting.
|
||
|
<p> <p>See also <a href="#copy">copy</a>(), <a href="#paste">paste</a>(), and <a href="#setValidator">setValidator</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="del"></a>QLineEdit::del ()
|
||
|
</h3>
|
||
|
If no text is selected, deletes the character to the right of the
|
||
|
text cursor. If any text is selected, the cursor is moved to the
|
||
|
beginning of the selected text and the selected text is deleted.
|
||
|
<p> <p>See also <a href="#backspace">backspace</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="deselect"></a>QLineEdit::deselect ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Deselects any selected text.
|
||
|
<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#selectAll">selectAll</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="displayText"></a>QLineEdit::displayText () const
|
||
|
</h3><p>Returns the displayed text.
|
||
|
See the <a href="qlineedit.html#displayText-prop">"displayText"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="dragEnabled"></a>QLineEdit::dragEnabled () const
|
||
|
</h3><p>Returns TRUE if the lineedit starts a drag if the user presses and moves the mouse on some selected text; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#dragEnabled-prop">"dragEnabled"</a> property for details.
|
||
|
<h3 class=fn><a href="qlineedit.html#EchoMode-enum">EchoMode</a> <a name="echoMode"></a>QLineEdit::echoMode () const
|
||
|
</h3><p>Returns the line edit's echo mode.
|
||
|
See the <a href="qlineedit.html#echoMode-prop">"echoMode"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="edited"></a>QLineEdit::edited () const
|
||
|
</h3><p>Returns TRUE if the line edit has been edited. Use modified instead; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#edited-prop">"edited"</a> property for details.
|
||
|
<h3 class=fn>void <a name="end"></a>QLineEdit::end ( bool mark )
|
||
|
</h3>
|
||
|
Moves the text cursor to the end of the line unless it is already
|
||
|
there. If <em>mark</em> is TRUE, text is selected towards the last
|
||
|
position; otherwise, any selected text is unselected if the cursor
|
||
|
is moved.
|
||
|
<p> <p>See also <a href="#home">home</a>().
|
||
|
|
||
|
<h3 class=fn>bool <a name="frame"></a>QLineEdit::frame () const
|
||
|
</h3><p>Returns TRUE if the line edit draws itself with a frame; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="getSelection"></a>QLineEdit::getSelection ( int * start, int * end )
|
||
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
use <a href="#selectedText">selectedText</a>(), <a href="#selectionStart">selectionStart</a>()
|
||
|
<h3 class=fn>bool <a name="hasAcceptableInput"></a>QLineEdit::hasAcceptableInput () const
|
||
|
</h3><p>Returns TRUE if the input satisfies the inputMask and the validator; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#acceptableInput-prop">"acceptableInput"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="hasMarkedText"></a>QLineEdit::hasMarkedText () const
|
||
|
</h3><p>Returns TRUE if part of the text has been selected by the user. Use hasSelectedText instead; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#hasMarkedText-prop">"hasMarkedText"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="hasSelectedText"></a>QLineEdit::hasSelectedText () const
|
||
|
</h3><p>Returns TRUE if there is any text selected; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#hasSelectedText-prop">"hasSelectedText"</a> property for details.
|
||
|
<h3 class=fn>void <a name="home"></a>QLineEdit::home ( bool mark )
|
||
|
</h3>
|
||
|
Moves the text cursor to the beginning of the line unless it is
|
||
|
already there. If <em>mark</em> is TRUE, text is selected towards the
|
||
|
first position; otherwise, any selected text is unselected if the
|
||
|
cursor is moved.
|
||
|
<p> <p>See also <a href="#end">end</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="inputMask"></a>QLineEdit::inputMask () const
|
||
|
</h3><p>Returns the validation input mask.
|
||
|
See the <a href="qlineedit.html#inputMask-prop">"inputMask"</a> property for details.
|
||
|
<h3 class=fn>void <a name="insert"></a>QLineEdit::insert ( const <a href="qstring.html">QString</a> & newText )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Deletes any selected text, inserts <em>newText</em>, and validates the
|
||
|
result. If it is valid, it sets it as the new contents of the line
|
||
|
edit.
|
||
|
|
||
|
<h3 class=fn>bool <a name="isModified"></a>QLineEdit::isModified () const
|
||
|
</h3><p>Returns TRUE if the line edit's contents has been modified by the user; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#modified-prop">"modified"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="isReadOnly"></a>QLineEdit::isReadOnly () const
|
||
|
</h3><p>Returns TRUE if the line edit is read only; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="isRedoAvailable"></a>QLineEdit::isRedoAvailable () const
|
||
|
</h3><p>Returns TRUE if redo is available; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#redoAvailable-prop">"redoAvailable"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="isUndoAvailable"></a>QLineEdit::isUndoAvailable () const
|
||
|
</h3><p>Returns TRUE if undo is available; otherwise returns FALSE.
|
||
|
See the <a href="qlineedit.html#undoAvailable-prop">"undoAvailable"</a> property for details.
|
||
|
<h3 class=fn>void <a name="keyPressEvent"></a>QLineEdit::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a> * e )<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
Converts key press event <em>e</em> into a line edit action.
|
||
|
<p> If Return or Enter is pressed and the current text is valid (or
|
||
|
can be <a href="qvalidator.html#fixup">made valid</a> by the
|
||
|
validator), the signal <a href="#returnPressed">returnPressed</a>() is emitted.
|
||
|
<p> The default key bindings are listed in the <a href="#desc">detailed
|
||
|
description.</a>
|
||
|
|
||
|
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget</a>.
|
||
|
<h3 class=fn>void <a name="lostFocus"></a>QLineEdit::lostFocus ()<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when the line edit has lost focus.
|
||
|
<p> <p>See also <a href="qwidget.html#focus-prop">focus</a>, <a href="qwidget.html#focusInEvent">QWidget::focusInEvent</a>(), and <a href="qwidget.html#focusOutEvent">QWidget::focusOutEvent</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="markedText"></a>QLineEdit::markedText () const
|
||
|
</h3><p>Returns the text selected by the user. Use selectedText instead.
|
||
|
See the <a href="qlineedit.html#markedText-prop">"markedText"</a> property for details.
|
||
|
<h3 class=fn>int <a name="maxLength"></a>QLineEdit::maxLength () const
|
||
|
</h3><p>Returns the maximum permitted length of the text.
|
||
|
See the <a href="qlineedit.html#maxLength-prop">"maxLength"</a> property for details.
|
||
|
<h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSizeHint"></a>QLineEdit::minimumSizeHint () const<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Returns a minimum size for the line edit.
|
||
|
<p> The width returned is enough for at least one character.
|
||
|
|
||
|
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint">QWidget</a>.
|
||
|
<h3 class=fn>void <a name="paste"></a>QLineEdit::paste ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Inserts the clipboard's text at the cursor position, deleting any
|
||
|
selected text, providing the line edit is not <a href="#readOnly-prop">read-only</a>.
|
||
|
<p> If the end result would not be acceptable to the current
|
||
|
<a href="#setValidator">validator</a>, nothing happens.
|
||
|
<p> <p>See also <a href="#copy">copy</a>() and <a href="#cut">cut</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="redo"></a>QLineEdit::redo ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Redoes the last operation if redo is <a href="#redoAvailable-prop">available</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="repaintArea"></a>QLineEdit::repaintArea ( int from, int to )<tt> [protected]</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>
|
||
|
Repaints all characters from <em>from</em> to <em>to</em>. If cursorPos is
|
||
|
between from and to, ensures that cursorPos is visible.
|
||
|
|
||
|
<h3 class=fn>void <a name="returnPressed"></a>QLineEdit::returnPressed ()<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when the Return or Enter key is pressed.
|
||
|
Note that if there is a <a href="#validator">validator</a>() or <a href="#inputMask">inputMask</a>() set on the line
|
||
|
edit, the <a href="#returnPressed">returnPressed</a>() signal will only be emitted if the input
|
||
|
follows the inputMask() and the validator() returns <tt>Acceptable</tt>.
|
||
|
|
||
|
<p>Example: <a href="popup-example.html#x1610">popup/popup.cpp</a>.
|
||
|
<h3 class=fn>void <a name="selectAll"></a>QLineEdit::selectAll ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Selects all the text (i.e. highlights it) and moves the cursor to
|
||
|
the end. This is useful when a default value has been inserted
|
||
|
because if the user types before clicking on the widget, the
|
||
|
selected text will be deleted.
|
||
|
<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#deselect">deselect</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText"></a>QLineEdit::selectedText () const
|
||
|
</h3><p>Returns the selected text.
|
||
|
See the <a href="qlineedit.html#selectedText-prop">"selectedText"</a> property for details.
|
||
|
<h3 class=fn>void <a name="selectionChanged"></a>QLineEdit::selectionChanged ()<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted whenever the selection changes.
|
||
|
<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a> and <a href="#selectedText-prop">selectedText</a>.
|
||
|
|
||
|
<h3 class=fn>int <a name="selectionStart"></a>QLineEdit::selectionStart () const
|
||
|
</h3>
|
||
|
<a href="#selectionStart">selectionStart</a>() returns the index of the first selected character in the
|
||
|
line edit or -1 if no text is selected.
|
||
|
<p> <p>See also <a href="#selectedText-prop">selectedText</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="setAlignment"></a>QLineEdit::setAlignment ( int flag )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets the alignment of the line edit to <em>flag</em>.
|
||
|
See the <a href="qlineedit.html#alignment-prop">"alignment"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setCursorPosition"></a>QLineEdit::setCursorPosition ( int )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets the current cursor position for this line edit.
|
||
|
See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setDragEnabled"></a>QLineEdit::setDragEnabled ( bool b )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets whether the lineedit starts a drag if the user presses and moves the mouse on some selected text to <em>b</em>.
|
||
|
See the <a href="qlineedit.html#dragEnabled-prop">"dragEnabled"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setEchoMode"></a>QLineEdit::setEchoMode ( <a href="qlineedit.html#EchoMode-enum">EchoMode</a> )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets the line edit's echo mode.
|
||
|
See the <a href="qlineedit.html#echoMode-prop">"echoMode"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setEdited"></a>QLineEdit::setEdited ( bool )
|
||
|
</h3><p>Sets whether the line edit has been edited. Use modified instead.
|
||
|
See the <a href="qlineedit.html#edited-prop">"edited"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setFrame"></a>QLineEdit::setFrame ( bool )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets whether the line edit draws itself with a frame.
|
||
|
See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setInputMask"></a>QLineEdit::setInputMask ( const <a href="qstring.html">QString</a> & inputMask )
|
||
|
</h3><p>Sets the validation input mask to <em>inputMask</em>.
|
||
|
See the <a href="qlineedit.html#inputMask-prop">"inputMask"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setMaxLength"></a>QLineEdit::setMaxLength ( int )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets the maximum permitted length of the text.
|
||
|
See the <a href="qlineedit.html#maxLength-prop">"maxLength"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setReadOnly"></a>QLineEdit::setReadOnly ( bool )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets whether the line edit is read only.
|
||
|
See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setSelection"></a>QLineEdit::setSelection ( int start, int length )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Selects text from position <em>start</em> and for <em>length</em> characters.
|
||
|
<p> Note that this function sets the cursor's position to the end of
|
||
|
the selection regardless of its current position.
|
||
|
<p> <p>See also <a href="#deselect">deselect</a>(), <a href="#selectAll">selectAll</a>(), <a href="#getSelection">getSelection</a>(), <a href="#cursorForward">cursorForward</a>(), and <a href="#cursorBackward">cursorBackward</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setText"></a>QLineEdit::setText ( const <a href="qstring.html">QString</a> & )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets the line edit's text.
|
||
|
See the <a href="qlineedit.html#text-prop">"text"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setValidator"></a>QLineEdit::setValidator ( const <a href="qvalidator.html">QValidator</a> * v )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Sets this line edit to only accept input that the validator, <em>v</em>,
|
||
|
will accept. This allows you to place any arbitrary constraints on
|
||
|
the text which may be entered.
|
||
|
<p> If <em>v</em> == 0, <a href="#setValidator">setValidator</a>() removes the current input validator.
|
||
|
The initial setting is to have no input validator (i.e. any input
|
||
|
is accepted up to <a href="#maxLength">maxLength</a>()).
|
||
|
<p> <p>See also <a href="#validator">validator</a>(), <a href="qintvalidator.html">QIntValidator</a>, <a href="qdoublevalidator.html">QDoubleValidator</a>, and <a href="qregexpvalidator.html">QRegExpValidator</a>.
|
||
|
|
||
|
<p>Examples: <a href="lineedits-example.html#x180">lineedits/lineedits.cpp</a> and <a href="wizard-example.html#x7">wizard/wizard.cpp</a>.
|
||
|
<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QLineEdit::sizeHint () const<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Returns a recommended size for the widget.
|
||
|
<p> The width returned, in pixels, is usually enough for about 15 to
|
||
|
20 characters.
|
||
|
|
||
|
<p>Example: <a href="addressbook-example.html#x583">addressbook/centralwidget.cpp</a>.
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QLineEdit::text () const
|
||
|
</h3><p>Returns the line edit's text.
|
||
|
See the <a href="qlineedit.html#text-prop">"text"</a> property for details.
|
||
|
<h3 class=fn>void <a name="textChanged"></a>QLineEdit::textChanged ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted whenever the text changes. The argument is
|
||
|
the new text.
|
||
|
|
||
|
<p>Examples: <a href="qaxserver-example-simple.html#x2523">simple/main.cpp</a>, <a href="wizard-example.html#x9">wizard/wizard.cpp</a>, and <a href="xform-example.html#x1231">xform/xform.cpp</a>.
|
||
|
<h3 class=fn>void <a name="undo"></a>QLineEdit::undo ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Undoes the last operation if undo is <a href="#undoAvailable-prop">available</a>. Deselects any current
|
||
|
selection, and updates the selection start to the current cursor
|
||
|
position.
|
||
|
|
||
|
<h3 class=fn>bool <a name="validateAndSet"></a>QLineEdit::validateAndSet ( const <a href="qstring.html">QString</a> & newText, int newPos, int newMarkAnchor, int newMarkDrag )
|
||
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
Use <a href="#setText">setText</a>(), <a href="#setCursorPosition">setCursorPosition</a>() and <a href="#setSelection">setSelection</a>() instead.
|
||
|
|
||
|
<h3 class=fn>const <a href="qvalidator.html">QValidator</a> * <a name="validator"></a>QLineEdit::validator () const
|
||
|
</h3>
|
||
|
Returns a pointer to the current input validator, or 0 if no
|
||
|
validator has been set.
|
||
|
<p> <p>See also <a href="#setValidator">setValidator</a>().
|
||
|
|
||
|
<p>Example: <a href="wizard-example.html#x10">wizard/wizard.cpp</a>.
|
||
|
<hr><h2>Property Documentation</h2>
|
||
|
<h3 class=fn>bool <a name="acceptableInput-prop"></a>acceptableInput</h3>
|
||
|
<p>This property holds whether the input satisfies the inputMask and the validator.
|
||
|
<p>Get this property's value with <a href="#hasAcceptableInput">hasAcceptableInput</a>().
|
||
|
<p><p>See also <a href="#inputMask-prop">inputMask</a> and <a href="#setValidator">setValidator</a>().
|
||
|
|
||
|
<h3 class=fn>Alignment <a name="alignment-prop"></a>alignment</h3>
|
||
|
<p>This property holds the alignment of the line edit.
|
||
|
<p>Possible Values are <a href="qt.html#AlignmentFlags-enum">Qt::AlignAuto</a>, <a href="qt.html#AlignmentFlags-enum">Qt::AlignLeft</a>, <a href="qt.html#AlignmentFlags-enum">Qt::AlignRight</a> and <a href="qt.html#AlignmentFlags-enum">Qt::AlignHCenter</a>.
|
||
|
<p> Attempting to set the alignment to an illegal flag combination
|
||
|
does nothing.
|
||
|
<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::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>int <a name="cursorPosition-prop"></a>cursorPosition</h3>
|
||
|
<p>This property holds the current cursor position for this line edit.
|
||
|
<p>Setting the cursor position causes a repaint when appropriate.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setCursorPosition">setCursorPosition</a>() and get this property's value with <a href="#cursorPosition">cursorPosition</a>().
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="displayText-prop"></a>displayText</h3>
|
||
|
<p>This property holds the displayed text.
|
||
|
<p>If <a href="#EchoMode-enum">EchoMode</a> is <a href="#EchoMode-enum">Normal</a> this returns the same as <a href="#text">text</a>(); if
|
||
|
<a href="#EchoMode-enum">EchoMode</a> is <a href="#EchoMode-enum">Password</a> it returns a string of asterisks
|
||
|
text().length() characters long, e.g. "******"; if <a href="#EchoMode-enum">EchoMode</a> is
|
||
|
<a href="#EchoMode-enum">NoEcho</a> returns an empty string, "".
|
||
|
<p> <p>See also <a href="#echoMode-prop">echoMode</a>, <a href="#text-prop">text</a>, and <a href="#EchoMode-enum">EchoMode</a>.
|
||
|
|
||
|
<p>Get this property's value with <a href="#displayText">displayText</a>().
|
||
|
<h3 class=fn>bool <a name="dragEnabled-prop"></a>dragEnabled</h3>
|
||
|
<p>This property holds whether the lineedit starts a drag if the user presses and moves the mouse on some selected text.
|
||
|
<p>
|
||
|
<p>Set this property's value with <a href="#setDragEnabled">setDragEnabled</a>() and get this property's value with <a href="#dragEnabled">dragEnabled</a>().
|
||
|
<h3 class=fn><a href="qlineedit.html#EchoMode-enum">EchoMode</a> <a name="echoMode-prop"></a>echoMode</h3>
|
||
|
<p>This property holds the line edit's echo mode.
|
||
|
<p>The initial setting is <a href="#EchoMode-enum">Normal</a>, but QLineEdit also supports <a href="#EchoMode-enum">NoEcho</a> and <a href="#EchoMode-enum">Password</a> modes.
|
||
|
<p> The widget's display and the ability to copy or drag the text is
|
||
|
affected by this setting.
|
||
|
<p> <p>See also <a href="#EchoMode-enum">EchoMode</a> and <a href="#displayText-prop">displayText</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setEchoMode">setEchoMode</a>() and get this property's value with <a href="#echoMode">echoMode</a>().
|
||
|
<h3 class=fn>bool <a name="edited-prop"></a>edited</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>This property holds whether the line edit has been edited. Use modified instead.
|
||
|
<p>
|
||
|
<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>bool <a name="frame-prop"></a>frame</h3>
|
||
|
<p>This property holds whether the line edit draws itself with a frame.
|
||
|
<p>If enabled (the default) the line edit draws itself inside a
|
||
|
two-pixel frame, otherwise the line edit draws itself without any
|
||
|
frame.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setFrame">setFrame</a>() and get this property's value with <a href="#frame">frame</a>().
|
||
|
<h3 class=fn>bool <a name="hasMarkedText-prop"></a>hasMarkedText</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>This property holds whether part of the text has been selected by the user. Use hasSelectedText instead.
|
||
|
<p>
|
||
|
<p>Get this property's value with <a href="#hasMarkedText">hasMarkedText</a>().
|
||
|
<h3 class=fn>bool <a name="hasSelectedText-prop"></a>hasSelectedText</h3>
|
||
|
<p>This property holds whether there is any text selected.
|
||
|
<p>hasSelectedText() returns TRUE if some or all of the text has been
|
||
|
selected by the user; otherwise returns FALSE.
|
||
|
<p> <p>See also <a href="#selectedText-prop">selectedText</a>.
|
||
|
|
||
|
<p>Get this property's value with <a href="#hasSelectedText">hasSelectedText</a>().
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="inputMask-prop"></a>inputMask</h3>
|
||
|
<p>This property holds the validation input mask.
|
||
|
<p>If no mask is set, <a href="#inputMask">inputMask</a>() returns <a href="qstring.html#QString-null">QString::null</a>.
|
||
|
<p> Sets the QLineEdit's validation mask. Validators can be used
|
||
|
instead of, or in conjunction with masks; see <a href="#setValidator">setValidator</a>().
|
||
|
<p> Unset the mask and return to normal QLineEdit operation by passing
|
||
|
an empty string ("") or just calling <a href="#setInputMask">setInputMask</a>() with no
|
||
|
arguments.
|
||
|
<p> The mask format understands these mask characters:
|
||
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
||
|
<tr bgcolor="#a2c511"> <th valign="top">Character <th valign="top">Meaning
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>A</tt> <td valign="top">ASCII alphabetic character required. A-Z, a-z.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>a</tt> <td valign="top">ASCII alphabetic character permitted but not required.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>N</tt> <td valign="top">ASCII alphanumeric character required. A-Z, a-z, 0-9.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>n</tt> <td valign="top">ASCII alphanumeric character permitted but not required.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>X</tt> <td valign="top">Any character required.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qwidget.html#x-prop">x</a> <td valign="top">Any character permitted but not required.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>9</tt> <td valign="top">ASCII digit required. 0-9.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>0</tt> <td valign="top">ASCII digit permitted but not required.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>D</tt> <td valign="top">ASCII digit required. 1-9.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>d</tt> <td valign="top">ASCII digit permitted but not required (1-9).
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>#</tt> <td valign="top">ASCII digit or plus/minus sign permitted but not required.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>></tt> <td valign="top">All following alphabetic characters are uppercased.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt><</tt> <td valign="top">All following alphabetic characters are lowercased.
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>!</tt> <td valign="top">Switch off case conversion.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>\</tt> <td valign="top">Use <tt>\</tt> to escape the special
|
||
|
characters listed above to use them as
|
||
|
separators.
|
||
|
</table></center>
|
||
|
<p> The mask consists of a string of mask characters and separators,
|
||
|
optionally followed by a semi-colon and the character used for
|
||
|
blanks: the blank characters are always removed from the text
|
||
|
after editing. The default blank character is space.
|
||
|
<p> Examples:
|
||
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
||
|
<tr bgcolor="#a2c511"> <th valign="top">Mask <th valign="top">Notes
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>000.000.000.000;_</tt> <td valign="top">IP address; blanks are <tt>_</tt>.
|
||
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>0000-00-00</tt> <td valign="top">ISO Date; blanks are <tt>space</tt>
|
||
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#</tt> <td valign="top">License number;
|
||
|
blanks are <tt>-</tt> and all (alphabetic) characters are converted to
|
||
|
uppercase.
|
||
|
</table></center>
|
||
|
<p> To get range control (e.g. for an IP address) use masks together
|
||
|
with <a href="#setValidator">validators</a>.
|
||
|
<p> <p>See also <a href="#maxLength-prop">maxLength</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setInputMask">setInputMask</a>() and get this property's value with <a href="#inputMask">inputMask</a>().
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="markedText-prop"></a>markedText</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>This property holds the text selected by the user. Use selectedText instead.
|
||
|
<p>
|
||
|
<p>Get this property's value with <a href="#markedText">markedText</a>().
|
||
|
<h3 class=fn>int <a name="maxLength-prop"></a>maxLength</h3>
|
||
|
<p>This property holds the maximum permitted length of the text.
|
||
|
<p>If the text is too long, it is truncated at the limit.
|
||
|
<p> If truncation occurs any selected text will be unselected, the
|
||
|
cursor position is set to 0 and the first part of the string is
|
||
|
shown.
|
||
|
<p> If the line edit has an input mask, the mask defines the maximum
|
||
|
string length.
|
||
|
<p> <p>See also <a href="#inputMask-prop">inputMask</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setMaxLength">setMaxLength</a>() and get this property's value with <a href="#maxLength">maxLength</a>().
|
||
|
<h3 class=fn>bool <a name="modified-prop"></a>modified</h3>
|
||
|
<p>This property holds whether the line edit's contents has been modified by the user.
|
||
|
<p>The modified flag is never read by QLineEdit; it has a default value
|
||
|
of FALSE and is changed to TRUE whenever the user changes the line
|
||
|
edit's contents.
|
||
|
<p> This is useful for things that need to provide a default value but
|
||
|
do not start out knowing what the default should be (perhaps it
|
||
|
depends on other fields on the form). Start the line edit without
|
||
|
the best default, and when the default is known, if modified()
|
||
|
returns FALSE (the user hasn't entered any text), insert the
|
||
|
default value.
|
||
|
<p> Calling <a href="#clearModified">clearModified</a>() or <a href="#setText">setText</a>() resets the modified flag to
|
||
|
FALSE.
|
||
|
|
||
|
<p>Get this property's value with <a href="#isModified">isModified</a>().
|
||
|
<h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3>
|
||
|
<p>This property holds whether the line edit is read only.
|
||
|
<p>In read-only mode, the user can still copy the text to the
|
||
|
clipboard or drag-and-drop the text (if <a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>),
|
||
|
but cannot edit it.
|
||
|
<p> QLineEdit does not show a cursor in read-only mode.
|
||
|
<p> <p>See also <a href="qwidget.html#enabled-prop">enabled</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setReadOnly">setReadOnly</a>() and get this property's value with <a href="#isReadOnly">isReadOnly</a>().
|
||
|
<h3 class=fn>bool <a name="redoAvailable-prop"></a>redoAvailable</h3>
|
||
|
<p>This property holds whether redo is available.
|
||
|
<p>
|
||
|
<p>Get this property's value with <a href="#isRedoAvailable">isRedoAvailable</a>().
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText-prop"></a>selectedText</h3>
|
||
|
<p>This property holds the selected text.
|
||
|
<p>If there is no selected text this property's value is
|
||
|
<a href="qstring.html#QString-null">QString::null</a>.
|
||
|
<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a>.
|
||
|
|
||
|
<p>Get this property's value with <a href="#selectedText">selectedText</a>().
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3>
|
||
|
<p>This property holds the line edit's text.
|
||
|
<p>Note that setting this property clears the selection, clears the
|
||
|
undo/redo history, moves the cursor to the end of the line and
|
||
|
resets the <a href="#modified-prop">modified</a> property to FALSE. The text is not
|
||
|
validated when inserted with <a href="#setText">setText</a>().
|
||
|
<p> The text is truncated to <a href="#maxLength">maxLength</a>() length.
|
||
|
<p> <p>See also <a href="#insert">insert</a>().
|
||
|
|
||
|
<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
|
||
|
<h3 class=fn>bool <a name="undoAvailable-prop"></a>undoAvailable</h3>
|
||
|
<p>This property holds whether undo is available.
|
||
|
<p>
|
||
|
<p>Get this property's value with <a href="#isUndoAvailable">isUndoAvailable</a>().
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">Qt 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>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|