source: trunk/doc/html/qlineedit.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 51.7 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qlineedit.cpp:268 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QLineEdit Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<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>
33
34<p>The QLineEdit widget is a one-line text editor.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qlineedit-h.html">qlineedit.h</a>&gt;</tt>
37<p>Inherits <a href="qframe.html">QFrame</a>.
38<p><a href="qlineedit-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QLineEdit"><b>QLineEdit</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
42<li class=fn><a href="#QLineEdit-2"><b>QLineEdit</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;contents, QWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
43<li class=fn><a href="#QLineEdit-3"><b>QLineEdit</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;contents, const&nbsp;QString&nbsp;&amp;&nbsp;inputMask, QWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
44<li class=fn><a href="#~QLineEdit"><b>~QLineEdit</b></a> ()</li>
45<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
46<li class=fn>QString <a href="#displayText"><b>displayText</b></a> () const</li>
47<li class=fn>int <a href="#maxLength"><b>maxLength</b></a> () const</li>
48<li class=fn>bool <a href="#frame"><b>frame</b></a> () const</li>
49<li class=fn>enum <a href="#EchoMode-enum"><b>EchoMode</b></a> { Normal, NoEcho, Password }</li>
50<li class=fn>EchoMode <a href="#echoMode"><b>echoMode</b></a> () const</li>
51<li class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</li>
52<li class=fn>const QValidator * <a href="#validator"><b>validator</b></a> () const</li>
53<li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
54<li class=fn>virtual QSize <a href="#minimumSizeHint"><b>minimumSizeHint</b></a> () const</li>
55<li class=fn>int <a href="#cursorPosition"><b>cursorPosition</b></a> () const</li>
56<li class=fn>bool validateAndSet ( const&nbsp;QString&nbsp;&amp;&nbsp;newText, int&nbsp;newPos, int&nbsp;newMarkAnchor, int&nbsp;newMarkDrag ) &nbsp;<em>(obsolete)</em></li>
57<li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li>
58<li class=fn>void cursorLeft ( bool&nbsp;mark, int&nbsp;steps = 1 ) &nbsp;<em>(obsolete)</em></li>
59<li class=fn>void cursorRight ( bool&nbsp;mark, int&nbsp;steps = 1 ) &nbsp;<em>(obsolete)</em></li>
60<li class=fn>void <a href="#cursorForward"><b>cursorForward</b></a> ( bool&nbsp;mark, int&nbsp;steps = 1 )</li>
61<li class=fn>void <a href="#cursorBackward"><b>cursorBackward</b></a> ( bool&nbsp;mark, int&nbsp;steps = 1 )</li>
62<li class=fn>void <a href="#cursorWordForward"><b>cursorWordForward</b></a> ( bool&nbsp;mark )</li>
63<li class=fn>void <a href="#cursorWordBackward"><b>cursorWordBackward</b></a> ( bool&nbsp;mark )</li>
64<li class=fn>void <a href="#backspace"><b>backspace</b></a> ()</li>
65<li class=fn>void <a href="#del"><b>del</b></a> ()</li>
66<li class=fn>void <a href="#home"><b>home</b></a> ( bool&nbsp;mark )</li>
67<li class=fn>void <a href="#end"><b>end</b></a> ( bool&nbsp;mark )</li>
68<li class=fn>bool <a href="#isModified"><b>isModified</b></a> () const</li>
69<li class=fn>void <a href="#clearModified"><b>clearModified</b></a> ()</li>
70<li class=fn>bool edited () const &nbsp;<em>(obsolete)</em></li>
71<li class=fn>void setEdited ( bool ) &nbsp;<em>(obsolete)</em></li>
72<li class=fn>bool <a href="#hasSelectedText"><b>hasSelectedText</b></a> () const</li>
73<li class=fn>QString <a href="#selectedText"><b>selectedText</b></a> () const</li>
74<li class=fn>int <a href="#selectionStart"><b>selectionStart</b></a> () const</li>
75<li class=fn>bool <a href="#isUndoAvailable"><b>isUndoAvailable</b></a> () const</li>
76<li class=fn>bool <a href="#isRedoAvailable"><b>isRedoAvailable</b></a> () const</li>
77<li class=fn>bool hasMarkedText () const &nbsp;<em>(obsolete)</em></li>
78<li class=fn>QString markedText () const &nbsp;<em>(obsolete)</em></li>
79<li class=fn>bool <a href="#dragEnabled"><b>dragEnabled</b></a> () const</li>
80<li class=fn>QString <a href="#inputMask"><b>inputMask</b></a> () const</li>
81<li class=fn>void <a href="#setInputMask"><b>setInputMask</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;inputMask )</li>
82<li class=fn>bool <a href="#hasAcceptableInput"><b>hasAcceptableInput</b></a> () const</li>
83<li class=fn>int characterAt ( int&nbsp;xpos, QChar&nbsp;*&nbsp;chr ) const &nbsp;<em>(obsolete)</em></li>
84<li class=fn>bool getSelection ( int&nbsp;*&nbsp;start, int&nbsp;*&nbsp;end ) &nbsp;<em>(obsolete)</em></li>
85</ul>
86<h2>Public Slots</h2>
87<ul>
88<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const QString &amp; )</li>
89<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ()</li>
90<li class=fn>virtual void <a href="#deselect"><b>deselect</b></a> ()</li>
91<li class=fn>virtual void <a href="#clearValidator"><b>clearValidator</b></a> ()</li>
92<li class=fn>virtual void <a href="#insert"><b>insert</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;newText )</li>
93<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
94<li class=fn>virtual void <a href="#undo"><b>undo</b></a> ()</li>
95<li class=fn>virtual void <a href="#redo"><b>redo</b></a> ()</li>
96<li class=fn>virtual void <a href="#setMaxLength"><b>setMaxLength</b></a> ( int )</li>
97<li class=fn>virtual void <a href="#setFrame"><b>setFrame</b></a> ( bool )</li>
98<li class=fn>virtual void <a href="#setEchoMode"><b>setEchoMode</b></a> ( EchoMode )</li>
99<li class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool )</li>
100<li class=fn>virtual void <a href="#setValidator"><b>setValidator</b></a> ( const&nbsp;QValidator&nbsp;*&nbsp;v )</li>
101<li class=fn>virtual void <a href="#setSelection"><b>setSelection</b></a> ( int&nbsp;start, int&nbsp;length )</li>
102<li class=fn>virtual void <a href="#setCursorPosition"><b>setCursorPosition</b></a> ( int )</li>
103<li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int&nbsp;flag )</li>
104<li class=fn>virtual void <a href="#cut"><b>cut</b></a> ()</li>
105<li class=fn>virtual void <a href="#copy"><b>copy</b></a> () const</li>
106<li class=fn>virtual void <a href="#paste"><b>paste</b></a> ()</li>
107<li class=fn>virtual void <a href="#setDragEnabled"><b>setDragEnabled</b></a> ( bool&nbsp;b )</li>
108</ul>
109<h2>Signals</h2>
110<ul>
111<li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ( const QString &amp; )</li>
112<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ()</li>
113<li class=fn>void <a href="#lostFocus"><b>lostFocus</b></a> ()</li>
114<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
115</ul>
116<h2>Properties</h2>
117<ul>
118<li class=fn>bool <a href="#acceptableInput-prop"><b>acceptableInput</b></a>&nbsp;- whether the input satisfies the inputMask and the validator &nbsp;<em>(read only)</em></li>
119<li class=fn>Alignment <a href="#alignment-prop"><b>alignment</b></a>&nbsp;- the alignment of the line edit</li>
120<li class=fn>int <a href="#cursorPosition-prop"><b>cursorPosition</b></a>&nbsp;- the current cursor position for this line edit</li>
121<li class=fn>QString <a href="#displayText-prop"><b>displayText</b></a>&nbsp;- the displayed text &nbsp;<em>(read only)</em></li>
122<li class=fn>bool <a href="#dragEnabled-prop"><b>dragEnabled</b></a>&nbsp;- whether the lineedit starts a drag if the user presses and moves the mouse on some selected text</li>
123<li class=fn>EchoMode <a href="#echoMode-prop"><b>echoMode</b></a>&nbsp;- the line edit's echo mode</li>
124<li class=fn>bool edited&nbsp;- whether the line edit has been edited. Use modified instead &nbsp;<em>(obsolete)</em></li>
125<li class=fn>bool <a href="#frame-prop"><b>frame</b></a>&nbsp;- whether the line edit draws itself with a frame</li>
126<li class=fn>bool hasMarkedText&nbsp;- whether part of the text has been selected by the user. Use hasSelectedText instead &nbsp;<em>(read only)</em> &nbsp;<em>(obsolete)</em></li>
127<li class=fn>bool <a href="#hasSelectedText-prop"><b>hasSelectedText</b></a>&nbsp;- whether there is any text selected &nbsp;<em>(read only)</em></li>
128<li class=fn>QString <a href="#inputMask-prop"><b>inputMask</b></a>&nbsp;- the validation input mask</li>
129<li class=fn>QString markedText&nbsp;- the text selected by the user. Use selectedText instead &nbsp;<em>(read only)</em> &nbsp;<em>(obsolete)</em></li>
130<li class=fn>int <a href="#maxLength-prop"><b>maxLength</b></a>&nbsp;- the maximum permitted length of the text</li>
131<li class=fn>bool <a href="#modified-prop"><b>modified</b></a>&nbsp;- whether the line edit's contents has been modified by the user &nbsp;<em>(read only)</em></li>
132<li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a>&nbsp;- whether the line edit is read only</li>
133<li class=fn>bool <a href="#redoAvailable-prop"><b>redoAvailable</b></a>&nbsp;- whether redo is available &nbsp;<em>(read only)</em></li>
134<li class=fn>QString <a href="#selectedText-prop"><b>selectedText</b></a>&nbsp;- the selected text &nbsp;<em>(read only)</em></li>
135<li class=fn>QString <a href="#text-prop"><b>text</b></a>&nbsp;- the line edit's text</li>
136<li class=fn>bool <a href="#undoAvailable-prop"><b>undoAvailable</b></a>&nbsp;- whether undo is available &nbsp;<em>(read only)</em></li>
137</ul>
138<h2>Protected Members</h2>
139<ul>
140<li class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( QKeyEvent&nbsp;*&nbsp;e )</li>
141<li class=fn>virtual QPopupMenu * <a href="#createPopupMenu"><b>createPopupMenu</b></a> ()</li>
142<li class=fn>void repaintArea ( int&nbsp;from, int&nbsp;to ) &nbsp;<em>(obsolete)</em></li>
143</ul>
144<hr><a name="details"></a><h2>Detailed Description</h2>
145
146
147The QLineEdit widget is a one-line text editor.
148<p>
149
150<p> A line edit allows the user to enter and edit a single line of
151plain text with a useful collection of editing functions,
152including undo and redo, cut and paste, and drag and drop.
153<p> By changing the <a href="#echoMode">echoMode</a>() of a line edit, it can also be used as
154a "write-only" field, for inputs such as passwords.
155<p> The length of the text can be constrained to <a href="#maxLength">maxLength</a>(). The text
156can be arbitrarily constrained using a <a href="#validator">validator</a>() or an
157<a href="#inputMask">inputMask</a>(), or both.
158<p> A related class is <a href="qtextedit.html">QTextEdit</a> which allows multi-line, rich-text
159editing.
160<p> You can change the text with <a href="#setText">setText</a>() or <a href="#insert">insert</a>(). The text is
161retrieved with <a href="#text">text</a>(); the displayed text (which may be different,
162see <a href="#EchoMode-enum">EchoMode</a>) is retrieved with <a href="#displayText">displayText</a>(). Text can be
163selected with <a href="#setSelection">setSelection</a>() or <a href="#selectAll">selectAll</a>(), and the selection can
164be <a href="#cut">cut</a>(), <a href="#copy">copy</a>()ied and <a href="#paste">paste</a>()d. The text can be aligned with
165<a href="#setAlignment">setAlignment</a>().
166<p> When the text changes the <a href="#textChanged">textChanged</a>() signal is emitted; when
167the Return or Enter key is pressed the <a href="#returnPressed">returnPressed</a>() signal is
168emitted. Note that if there is a validator set on the line edit,
169the returnPressed() signal will only be emitted if the validator
170returns <tt>Acceptable</tt>.
171<p> By default, QLineEdits have a frame as specified by the Windows
172and <a href="motif-extension.html#Motif">Motif</a> style guides; you can turn it off by calling
173<a href="#setFrame">setFrame</a>(FALSE).
174<p> The default key bindings are described below. The line edit also
175provides a context menu (usually invoked by a right mouse click)
176that presents some of these editing options.
177<a name="desc"></a>
178<center><table cellpadding="4" cellspacing="2" border="0">
179<tr bgcolor="#a2c511"> <th valign="top">Keypress <th valign="top">Action
180<tr bgcolor="#f0f0f0"> <td valign="top">Left Arrow <td valign="top">Moves the cursor one character to the left.
181<tr bgcolor="#d0d0d0"> <td valign="top">Shift+Left Arrow <td valign="top">Moves and selects text one character to the left.
182<tr bgcolor="#f0f0f0"> <td valign="top">Right Arrow <td valign="top">Moves the cursor one character to the right.
183<tr bgcolor="#d0d0d0"> <td valign="top">Shift+Right Arrow <td valign="top">Moves and selects text one character to the right.
184<tr bgcolor="#f0f0f0"> <td valign="top">Home <td valign="top">Moves the cursor to the beginning of the line.
185<tr bgcolor="#d0d0d0"> <td valign="top">End <td valign="top">Moves the cursor to the end of the line.
186<tr bgcolor="#f0f0f0"> <td valign="top">Backspace <td valign="top">Deletes the character to the left of the cursor.
187<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Backspace <td valign="top">Deletes the word to the left of the cursor.
188<tr bgcolor="#f0f0f0"> <td valign="top">Delete <td valign="top">Deletes the character to the right of the cursor.
189<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Delete <td valign="top">Deletes the word to the right of the cursor.
190<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+A <td valign="top">Moves the cursor to the beginning of the line.
191<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+B <td valign="top">Moves the cursor one character to the left.
192<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+C <td valign="top">Copies the selected text to the clipboard.
193(Windows also supports Ctrl+Insert for this operation.)
194<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+D <td valign="top">Deletes the character to the right of the cursor.
195<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+E <td valign="top">Moves the cursor to the end of the line.
196<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+F <td valign="top">Moves the cursor one character to the right.
197<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+H <td valign="top">Deletes the character to the left of the cursor.
198<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+K <td valign="top">Deletes to the end of the line.
199<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+V <td valign="top">Pastes the clipboard text into line edit.
200(Windows also supports Shift+Insert for this operation.)
201<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+X <td valign="top">Deletes the selected text and copies it to the clipboard.
202(Windows also supports Shift+Delete for this operation.)
203<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+Z <td valign="top">Undoes the last operation.
204<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Y <td valign="top">Redoes the last undone operation.
205</table></center>
206<p> Any other key sequence that represents a valid character, will
207cause the character to be inserted into the line edit.
208<p> <img src=qlined-m.png> <img src=qlined-w.png>
209<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>.
210
211<hr><h2>Member Type Documentation</h2>
212<h3 class=fn><a name="EchoMode-enum"></a>QLineEdit::EchoMode</h3>
213
214<p> This enum type describes how a line edit should display its
215contents.
216<ul>
217<li><tt>QLineEdit::Normal</tt> - Display characters as they are entered. This is the
218default.
219<li><tt>QLineEdit::NoEcho</tt> - Do not display anything. This may be appropriate
220for passwords where even the length of the
221password should be kept secret.
222<li><tt>QLineEdit::Password</tt> - Display asterisks instead of the characters
223actually entered.
224</ul><p> <p>See also <a href="#echoMode-prop">echoMode</a> and <a href="#echoMode-prop">echoMode</a>.
225
226<hr><h2>Member Function Documentation</h2>
227<h3 class=fn><a name="QLineEdit"></a>QLineEdit::QLineEdit ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )
228</h3>
229Constructs a line edit with no text.
230<p> The maximum text length is set to 32767 characters.
231<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
232<p> <p>See also <a href="#text-prop">text</a> and <a href="#maxLength-prop">maxLength</a>.
233
234<h3 class=fn><a name="QLineEdit-2"></a>QLineEdit::QLineEdit ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;contents, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )
235</h3>
236Constructs a line edit containing the text <em>contents</em>.
237<p> The cursor position is set to the end of the line and the maximum
238text length to 32767 characters.
239<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a>
240constructor.
241<p> <p>See also <a href="#text-prop">text</a> and <a href="#maxLength-prop">maxLength</a>.
242
243<h3 class=fn><a name="QLineEdit-3"></a>QLineEdit::QLineEdit ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;contents, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;inputMask, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )
244</h3>
245Constructs a line edit with an input <em>inputMask</em> and the text <em>contents</em>.
246<p> The cursor position is set to the end of the line and the maximum
247text length is set to the length of the mask (the number of mask
248characters and separators).
249<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a>
250constructor.
251<p> <p>See also <a href="qwidget.html#setMask">setMask</a>() and <a href="#text-prop">text</a>.
252
253<h3 class=fn><a name="~QLineEdit"></a>QLineEdit::~QLineEdit ()
254</h3>
255Destroys the line edit.
256
257<h3 class=fn>int <a name="alignment"></a>QLineEdit::alignment () const
258</h3><p>Returns the alignment of the line edit.
259See the <a href="qlineedit.html#alignment-prop">"alignment"</a> property for details.
260<h3 class=fn>void <a name="backspace"></a>QLineEdit::backspace ()
261</h3>
262If no text is selected, deletes the character to the left of the
263text cursor and moves the cursor one position to the left. If any
264text is selected, the cursor is moved to the beginning of the
265selected text and the selected text is deleted.
266<p> <p>See also <a href="#del">del</a>().
267
268<h3 class=fn>int <a name="characterAt"></a>QLineEdit::characterAt ( int&nbsp;xpos, <a href="qchar.html">QChar</a>&nbsp;*&nbsp;chr ) const
269</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
270<p>
271<h3 class=fn>void <a name="clear"></a>QLineEdit::clear ()<tt> [virtual slot]</tt>
272</h3>
273Clears the contents of the line edit.
274
275<h3 class=fn>void <a name="clearModified"></a>QLineEdit::clearModified ()
276</h3>
277Resets the modified flag to FALSE.
278<p> <p>See also <a href="#modified-prop">modified</a>.
279
280<h3 class=fn>void <a name="clearValidator"></a>QLineEdit::clearValidator ()<tt> [virtual slot]</tt>
281</h3>
282This slot is equivalent to <a href="#setValidator">setValidator</a>(0).
283
284<h3 class=fn>void <a name="copy"></a>QLineEdit::copy () const<tt> [virtual slot]</tt>
285</h3>
286Copies the selected text to the clipboard, if there is any, and if
287<a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>.
288<p> <p>See also <a href="#cut">cut</a>() and <a href="#paste">paste</a>().
289
290<h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a>&nbsp;* <a name="createPopupMenu"></a>QLineEdit::createPopupMenu ()<tt> [virtual protected]</tt>
291</h3>
292This function is called to create the popup menu which is shown
293when the user clicks on the line edit with the right mouse button.
294If you want to create a custom popup menu, reimplement this
295function and return the popup menu you create. The popup menu's
296ownership is transferred to the caller.
297
298<h3 class=fn>void <a name="cursorBackward"></a>QLineEdit::cursorBackward ( bool&nbsp;mark, int&nbsp;steps = 1 )
299</h3>
300Moves the cursor back <em>steps</em> characters. If <em>mark</em> is TRUE each
301character moved over is added to the selection; if <em>mark</em> is
302FALSE the selection is cleared.
303<p> <p>See also <a href="#cursorForward">cursorForward</a>().
304
305<h3 class=fn>void <a name="cursorForward"></a>QLineEdit::cursorForward ( bool&nbsp;mark, int&nbsp;steps = 1 )
306</h3>
307Moves the cursor forward <em>steps</em> characters. If <em>mark</em> is TRUE
308each character moved over is added to the selection; if <em>mark</em> is
309FALSE the selection is cleared.
310<p> <p>See also <a href="#cursorBackward">cursorBackward</a>().
311
312<h3 class=fn>void <a name="cursorLeft"></a>QLineEdit::cursorLeft ( bool&nbsp;mark, int&nbsp;steps = 1 )
313</h3>
314<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
315<p>
316For compatibilty with older applications only. Use <a href="#cursorBackward">cursorBackward</a>()
317instead.
318<p>See also <a href="#cursorBackward">cursorBackward</a>().
319
320<h3 class=fn>int <a name="cursorPosition"></a>QLineEdit::cursorPosition () const
321</h3><p>Returns the current cursor position for this line edit.
322See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.
323<h3 class=fn>void <a name="cursorRight"></a>QLineEdit::cursorRight ( bool&nbsp;mark, int&nbsp;steps = 1 )
324</h3>
325<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
326<p>
327<p> Use <a href="#cursorForward">cursorForward</a>() instead.
328<p> <p>See also <a href="#cursorForward">cursorForward</a>().
329
330<h3 class=fn>void <a name="cursorWordBackward"></a>QLineEdit::cursorWordBackward ( bool&nbsp;mark )
331</h3>
332Moves the cursor one word backward. If <em>mark</em> is TRUE, the word
333is also selected.
334<p> <p>See also <a href="#cursorWordForward">cursorWordForward</a>().
335
336<h3 class=fn>void <a name="cursorWordForward"></a>QLineEdit::cursorWordForward ( bool&nbsp;mark )
337</h3>
338Moves the cursor one word forward. If <em>mark</em> is TRUE, the word is
339also selected.
340<p> <p>See also <a href="#cursorWordBackward">cursorWordBackward</a>().
341
342<h3 class=fn>void <a name="cut"></a>QLineEdit::cut ()<tt> [virtual slot]</tt>
343</h3>
344Copies the selected text to the clipboard and deletes it, if there
345is any, and if <a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>.
346<p> If the current validator disallows deleting the selected text,
347<a href="#cut">cut</a>() will copy without deleting.
348<p> <p>See also <a href="#copy">copy</a>(), <a href="#paste">paste</a>(), and <a href="#setValidator">setValidator</a>().
349
350<h3 class=fn>void <a name="del"></a>QLineEdit::del ()
351</h3>
352If no text is selected, deletes the character to the right of the
353text cursor. If any text is selected, the cursor is moved to the
354beginning of the selected text and the selected text is deleted.
355<p> <p>See also <a href="#backspace">backspace</a>().
356
357<h3 class=fn>void <a name="deselect"></a>QLineEdit::deselect ()<tt> [virtual slot]</tt>
358</h3>
359Deselects any selected text.
360<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#selectAll">selectAll</a>().
361
362<h3 class=fn><a href="qstring.html">QString</a> <a name="displayText"></a>QLineEdit::displayText () const
363</h3><p>Returns the displayed text.
364See the <a href="qlineedit.html#displayText-prop">"displayText"</a> property for details.
365<h3 class=fn>bool <a name="dragEnabled"></a>QLineEdit::dragEnabled () const
366</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.
367See the <a href="qlineedit.html#dragEnabled-prop">"dragEnabled"</a> property for details.
368<h3 class=fn><a href="qlineedit.html#EchoMode-enum">EchoMode</a> <a name="echoMode"></a>QLineEdit::echoMode () const
369</h3><p>Returns the line edit's echo mode.
370See the <a href="qlineedit.html#echoMode-prop">"echoMode"</a> property for details.
371<h3 class=fn>bool <a name="edited"></a>QLineEdit::edited () const
372</h3><p>Returns TRUE if the line edit has been edited. Use modified instead; otherwise returns FALSE.
373See the <a href="qlineedit.html#edited-prop">"edited"</a> property for details.
374<h3 class=fn>void <a name="end"></a>QLineEdit::end ( bool&nbsp;mark )
375</h3>
376Moves the text cursor to the end of the line unless it is already
377there. If <em>mark</em> is TRUE, text is selected towards the last
378position; otherwise, any selected text is unselected if the cursor
379is moved.
380<p> <p>See also <a href="#home">home</a>().
381
382<h3 class=fn>bool <a name="frame"></a>QLineEdit::frame () const
383</h3><p>Returns TRUE if the line edit draws itself with a frame; otherwise returns FALSE.
384See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.
385<h3 class=fn>bool <a name="getSelection"></a>QLineEdit::getSelection ( int&nbsp;*&nbsp;start, int&nbsp;*&nbsp;end )
386</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
387use <a href="#selectedText">selectedText</a>(), <a href="#selectionStart">selectionStart</a>()
388<h3 class=fn>bool <a name="hasAcceptableInput"></a>QLineEdit::hasAcceptableInput () const
389</h3><p>Returns TRUE if the input satisfies the inputMask and the validator; otherwise returns FALSE.
390See the <a href="qlineedit.html#acceptableInput-prop">"acceptableInput"</a> property for details.
391<h3 class=fn>bool <a name="hasMarkedText"></a>QLineEdit::hasMarkedText () const
392</h3><p>Returns TRUE if part of the text has been selected by the user. Use hasSelectedText instead; otherwise returns FALSE.
393See the <a href="qlineedit.html#hasMarkedText-prop">"hasMarkedText"</a> property for details.
394<h3 class=fn>bool <a name="hasSelectedText"></a>QLineEdit::hasSelectedText () const
395</h3><p>Returns TRUE if there is any text selected; otherwise returns FALSE.
396See the <a href="qlineedit.html#hasSelectedText-prop">"hasSelectedText"</a> property for details.
397<h3 class=fn>void <a name="home"></a>QLineEdit::home ( bool&nbsp;mark )
398</h3>
399Moves the text cursor to the beginning of the line unless it is
400already there. If <em>mark</em> is TRUE, text is selected towards the
401first position; otherwise, any selected text is unselected if the
402cursor is moved.
403<p> <p>See also <a href="#end">end</a>().
404
405<h3 class=fn><a href="qstring.html">QString</a> <a name="inputMask"></a>QLineEdit::inputMask () const
406</h3><p>Returns the validation input mask.
407See the <a href="qlineedit.html#inputMask-prop">"inputMask"</a> property for details.
408<h3 class=fn>void <a name="insert"></a>QLineEdit::insert ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newText )<tt> [virtual slot]</tt>
409</h3>
410Deletes any selected text, inserts <em>newText</em>, and validates the
411result. If it is valid, it sets it as the new contents of the line
412edit.
413
414<h3 class=fn>bool <a name="isModified"></a>QLineEdit::isModified () const
415</h3><p>Returns TRUE if the line edit's contents has been modified by the user; otherwise returns FALSE.
416See the <a href="qlineedit.html#modified-prop">"modified"</a> property for details.
417<h3 class=fn>bool <a name="isReadOnly"></a>QLineEdit::isReadOnly () const
418</h3><p>Returns TRUE if the line edit is read only; otherwise returns FALSE.
419See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.
420<h3 class=fn>bool <a name="isRedoAvailable"></a>QLineEdit::isRedoAvailable () const
421</h3><p>Returns TRUE if redo is available; otherwise returns FALSE.
422See the <a href="qlineedit.html#redoAvailable-prop">"redoAvailable"</a> property for details.
423<h3 class=fn>bool <a name="isUndoAvailable"></a>QLineEdit::isUndoAvailable () const
424</h3><p>Returns TRUE if undo is available; otherwise returns FALSE.
425See the <a href="qlineedit.html#undoAvailable-prop">"undoAvailable"</a> property for details.
426<h3 class=fn>void <a name="keyPressEvent"></a>QLineEdit::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
427</h3>
428Converts key press event <em>e</em> into a line edit action.
429<p> If Return or Enter is pressed and the current text is valid (or
430can be <a href="qvalidator.html#fixup">made valid</a> by the
431validator), the signal <a href="#returnPressed">returnPressed</a>() is emitted.
432<p> The default key bindings are listed in the <a href="#desc">detailed
433 description.</a>
434
435<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget</a>.
436<h3 class=fn>void <a name="lostFocus"></a>QLineEdit::lostFocus ()<tt> [signal]</tt>
437</h3>
438
439<p> This signal is emitted when the line edit has lost focus.
440<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>().
441
442<h3 class=fn><a href="qstring.html">QString</a> <a name="markedText"></a>QLineEdit::markedText () const
443</h3><p>Returns the text selected by the user. Use selectedText instead.
444See the <a href="qlineedit.html#markedText-prop">"markedText"</a> property for details.
445<h3 class=fn>int <a name="maxLength"></a>QLineEdit::maxLength () const
446</h3><p>Returns the maximum permitted length of the text.
447See the <a href="qlineedit.html#maxLength-prop">"maxLength"</a> property for details.
448<h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSizeHint"></a>QLineEdit::minimumSizeHint () const<tt> [virtual]</tt>
449</h3>
450Returns a minimum size for the line edit.
451<p> The width returned is enough for at least one character.
452
453<p>Reimplemented from <a href="qwidget.html#minimumSizeHint">QWidget</a>.
454<h3 class=fn>void <a name="paste"></a>QLineEdit::paste ()<tt> [virtual slot]</tt>
455</h3>
456Inserts the clipboard's text at the cursor position, deleting any
457selected text, providing the line edit is not <a href="#readOnly-prop">read-only</a>.
458<p> If the end result would not be acceptable to the current
459<a href="#setValidator">validator</a>, nothing happens.
460<p> <p>See also <a href="#copy">copy</a>() and <a href="#cut">cut</a>().
461
462<h3 class=fn>void <a name="redo"></a>QLineEdit::redo ()<tt> [virtual slot]</tt>
463</h3>
464Redoes the last operation if redo is <a href="#redoAvailable-prop">available</a>.
465
466<h3 class=fn>void <a name="repaintArea"></a>QLineEdit::repaintArea ( int&nbsp;from, int&nbsp;to )<tt> [protected]</tt>
467</h3>
468<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
469<p>
470Repaints all characters from <em>from</em> to <em>to</em>. If cursorPos is
471between from and to, ensures that cursorPos is visible.
472
473<h3 class=fn>void <a name="returnPressed"></a>QLineEdit::returnPressed ()<tt> [signal]</tt>
474</h3>
475
476<p> This signal is emitted when the Return or Enter key is pressed.
477Note that if there is a <a href="#validator">validator</a>() or <a href="#inputMask">inputMask</a>() set on the line
478edit, the <a href="#returnPressed">returnPressed</a>() signal will only be emitted if the input
479follows the inputMask() and the validator() returns <tt>Acceptable</tt>.
480
481<p>Example: <a href="popup-example.html#x1610">popup/popup.cpp</a>.
482<h3 class=fn>void <a name="selectAll"></a>QLineEdit::selectAll ()<tt> [virtual slot]</tt>
483</h3>
484Selects all the text (i.e. highlights it) and moves the cursor to
485the end. This is useful when a default value has been inserted
486because if the user types before clicking on the widget, the
487selected text will be deleted.
488<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#deselect">deselect</a>().
489
490<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText"></a>QLineEdit::selectedText () const
491</h3><p>Returns the selected text.
492See the <a href="qlineedit.html#selectedText-prop">"selectedText"</a> property for details.
493<h3 class=fn>void <a name="selectionChanged"></a>QLineEdit::selectionChanged ()<tt> [signal]</tt>
494</h3>
495
496<p> This signal is emitted whenever the selection changes.
497<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a> and <a href="#selectedText-prop">selectedText</a>.
498
499<h3 class=fn>int <a name="selectionStart"></a>QLineEdit::selectionStart () const
500</h3>
501<a href="#selectionStart">selectionStart</a>() returns the index of the first selected character in the
502line edit or -1 if no text is selected.
503<p> <p>See also <a href="#selectedText-prop">selectedText</a>.
504
505<h3 class=fn>void <a name="setAlignment"></a>QLineEdit::setAlignment ( int&nbsp;flag )<tt> [virtual slot]</tt>
506</h3><p>Sets the alignment of the line edit to <em>flag</em>.
507See the <a href="qlineedit.html#alignment-prop">"alignment"</a> property for details.
508<h3 class=fn>void <a name="setCursorPosition"></a>QLineEdit::setCursorPosition ( int )<tt> [virtual slot]</tt>
509</h3><p>Sets the current cursor position for this line edit.
510See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.
511<h3 class=fn>void <a name="setDragEnabled"></a>QLineEdit::setDragEnabled ( bool&nbsp;b )<tt> [virtual slot]</tt>
512</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>.
513See the <a href="qlineedit.html#dragEnabled-prop">"dragEnabled"</a> property for details.
514<h3 class=fn>void <a name="setEchoMode"></a>QLineEdit::setEchoMode ( <a href="qlineedit.html#EchoMode-enum">EchoMode</a> )<tt> [virtual slot]</tt>
515</h3><p>Sets the line edit's echo mode.
516See the <a href="qlineedit.html#echoMode-prop">"echoMode"</a> property for details.
517<h3 class=fn>void <a name="setEdited"></a>QLineEdit::setEdited ( bool )
518</h3><p>Sets whether the line edit has been edited. Use modified instead.
519See the <a href="qlineedit.html#edited-prop">"edited"</a> property for details.
520<h3 class=fn>void <a name="setFrame"></a>QLineEdit::setFrame ( bool )<tt> [virtual slot]</tt>
521</h3><p>Sets whether the line edit draws itself with a frame.
522See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.
523<h3 class=fn>void <a name="setInputMask"></a>QLineEdit::setInputMask ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;inputMask )
524</h3><p>Sets the validation input mask to <em>inputMask</em>.
525See the <a href="qlineedit.html#inputMask-prop">"inputMask"</a> property for details.
526<h3 class=fn>void <a name="setMaxLength"></a>QLineEdit::setMaxLength ( int )<tt> [virtual slot]</tt>
527</h3><p>Sets the maximum permitted length of the text.
528See the <a href="qlineedit.html#maxLength-prop">"maxLength"</a> property for details.
529<h3 class=fn>void <a name="setReadOnly"></a>QLineEdit::setReadOnly ( bool )<tt> [virtual slot]</tt>
530</h3><p>Sets whether the line edit is read only.
531See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.
532<h3 class=fn>void <a name="setSelection"></a>QLineEdit::setSelection ( int&nbsp;start, int&nbsp;length )<tt> [virtual slot]</tt>
533</h3>
534Selects text from position <em>start</em> and for <em>length</em> characters.
535<p> Note that this function sets the cursor's position to the end of
536the selection regardless of its current position.
537<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>().
538
539<h3 class=fn>void <a name="setText"></a>QLineEdit::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [virtual slot]</tt>
540</h3><p>Sets the line edit's text.
541See the <a href="qlineedit.html#text-prop">"text"</a> property for details.
542<h3 class=fn>void <a name="setValidator"></a>QLineEdit::setValidator ( const&nbsp;<a href="qvalidator.html">QValidator</a>&nbsp;*&nbsp;v )<tt> [virtual slot]</tt>
543</h3>
544Sets this line edit to only accept input that the validator, <em>v</em>,
545will accept. This allows you to place any arbitrary constraints on
546the text which may be entered.
547<p> If <em>v</em> == 0, <a href="#setValidator">setValidator</a>() removes the current input validator.
548The initial setting is to have no input validator (i.e. any input
549is accepted up to <a href="#maxLength">maxLength</a>()).
550<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>.
551
552<p>Examples: <a href="lineedits-example.html#x180">lineedits/lineedits.cpp</a> and <a href="wizard-example.html#x7">wizard/wizard.cpp</a>.
553<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QLineEdit::sizeHint () const<tt> [virtual]</tt>
554</h3>
555Returns a recommended size for the widget.
556<p> The width returned, in pixels, is usually enough for about 15 to
55720 characters.
558
559<p>Example: <a href="addressbook-example.html#x583">addressbook/centralwidget.cpp</a>.
560<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QLineEdit::text () const
561</h3><p>Returns the line edit's text.
562See the <a href="qlineedit.html#text-prop">"text"</a> property for details.
563<h3 class=fn>void <a name="textChanged"></a>QLineEdit::textChanged ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
564</h3>
565
566<p> This signal is emitted whenever the text changes. The argument is
567the new text.
568
569<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>.
570<h3 class=fn>void <a name="undo"></a>QLineEdit::undo ()<tt> [virtual slot]</tt>
571</h3>
572Undoes the last operation if undo is <a href="#undoAvailable-prop">available</a>. Deselects any current
573selection, and updates the selection start to the current cursor
574position.
575
576<h3 class=fn>bool <a name="validateAndSet"></a>QLineEdit::validateAndSet ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newText, int&nbsp;newPos, int&nbsp;newMarkAnchor, int&nbsp;newMarkDrag )
577</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
578Use <a href="#setText">setText</a>(), <a href="#setCursorPosition">setCursorPosition</a>() and <a href="#setSelection">setSelection</a>() instead.
579
580<h3 class=fn>const&nbsp;<a href="qvalidator.html">QValidator</a>&nbsp;* <a name="validator"></a>QLineEdit::validator () const
581</h3>
582Returns a pointer to the current input validator, or 0 if no
583validator has been set.
584<p> <p>See also <a href="#setValidator">setValidator</a>().
585
586<p>Example: <a href="wizard-example.html#x10">wizard/wizard.cpp</a>.
587<hr><h2>Property Documentation</h2>
588<h3 class=fn>bool <a name="acceptableInput-prop"></a>acceptableInput</h3>
589<p>This property holds whether the input satisfies the inputMask and the validator.
590<p>Get this property's value with <a href="#hasAcceptableInput">hasAcceptableInput</a>().
591<p><p>See also <a href="#inputMask-prop">inputMask</a> and <a href="#setValidator">setValidator</a>().
592
593<h3 class=fn>Alignment <a name="alignment-prop"></a>alignment</h3>
594<p>This property holds the alignment of the line edit.
595<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>.
596<p> Attempting to set the alignment to an illegal flag combination
597does nothing.
598<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
599
600<p>Set this property's value with <a href="#setAlignment">setAlignment</a>() and get this property's value with <a href="#alignment">alignment</a>().
601<h3 class=fn>int <a name="cursorPosition-prop"></a>cursorPosition</h3>
602<p>This property holds the current cursor position for this line edit.
603<p>Setting the cursor position causes a repaint when appropriate.
604
605<p>Set this property's value with <a href="#setCursorPosition">setCursorPosition</a>() and get this property's value with <a href="#cursorPosition">cursorPosition</a>().
606<h3 class=fn><a href="qstring.html">QString</a> <a name="displayText-prop"></a>displayText</h3>
607<p>This property holds the displayed text.
608<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
609<a href="#EchoMode-enum">EchoMode</a> is <a href="#EchoMode-enum">Password</a> it returns a string of asterisks
610text().length() characters long, e.g. "******"; if <a href="#EchoMode-enum">EchoMode</a> is
611<a href="#EchoMode-enum">NoEcho</a> returns an empty string, "".
612<p> <p>See also <a href="#echoMode-prop">echoMode</a>, <a href="#text-prop">text</a>, and <a href="#EchoMode-enum">EchoMode</a>.
613
614<p>Get this property's value with <a href="#displayText">displayText</a>().
615<h3 class=fn>bool <a name="dragEnabled-prop"></a>dragEnabled</h3>
616<p>This property holds whether the lineedit starts a drag if the user presses and moves the mouse on some selected text.
617<p>
618<p>Set this property's value with <a href="#setDragEnabled">setDragEnabled</a>() and get this property's value with <a href="#dragEnabled">dragEnabled</a>().
619<h3 class=fn><a href="qlineedit.html#EchoMode-enum">EchoMode</a> <a name="echoMode-prop"></a>echoMode</h3>
620<p>This property holds the line edit's echo mode.
621<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.
622<p> The widget's display and the ability to copy or drag the text is
623affected by this setting.
624<p> <p>See also <a href="#EchoMode-enum">EchoMode</a> and <a href="#displayText-prop">displayText</a>.
625
626<p>Set this property's value with <a href="#setEchoMode">setEchoMode</a>() and get this property's value with <a href="#echoMode">echoMode</a>().
627<h3 class=fn>bool <a name="edited-prop"></a>edited</h3>
628<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
629<p> <p>This property holds whether the line edit has been edited. Use modified instead.
630<p>
631<p>Set this property's value with <a href="#setEdited">setEdited</a>() and get this property's value with <a href="#edited">edited</a>().
632<h3 class=fn>bool <a name="frame-prop"></a>frame</h3>
633<p>This property holds whether the line edit draws itself with a frame.
634<p>If enabled (the default) the line edit draws itself inside a
635two-pixel frame, otherwise the line edit draws itself without any
636frame.
637
638<p>Set this property's value with <a href="#setFrame">setFrame</a>() and get this property's value with <a href="#frame">frame</a>().
639<h3 class=fn>bool <a name="hasMarkedText-prop"></a>hasMarkedText</h3>
640<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
641<p> <p>This property holds whether part of the text has been selected by the user. Use hasSelectedText instead.
642<p>
643<p>Get this property's value with <a href="#hasMarkedText">hasMarkedText</a>().
644<h3 class=fn>bool <a name="hasSelectedText-prop"></a>hasSelectedText</h3>
645<p>This property holds whether there is any text selected.
646<p>hasSelectedText() returns TRUE if some or all of the text has been
647selected by the user; otherwise returns FALSE.
648<p> <p>See also <a href="#selectedText-prop">selectedText</a>.
649
650<p>Get this property's value with <a href="#hasSelectedText">hasSelectedText</a>().
651<h3 class=fn><a href="qstring.html">QString</a> <a name="inputMask-prop"></a>inputMask</h3>
652<p>This property holds the validation input mask.
653<p>If no mask is set, <a href="#inputMask">inputMask</a>() returns <a href="qstring.html#QString-null">QString::null</a>.
654<p> Sets the QLineEdit's validation mask. Validators can be used
655instead of, or in conjunction with masks; see <a href="#setValidator">setValidator</a>().
656<p> Unset the mask and return to normal QLineEdit operation by passing
657an empty string ("") or just calling <a href="#setInputMask">setInputMask</a>() with no
658arguments.
659<p> The mask format understands these mask characters:
660<center><table cellpadding="4" cellspacing="2" border="0">
661<tr bgcolor="#a2c511"> <th valign="top">Character <th valign="top">Meaning
662<tr bgcolor="#f0f0f0"> <td valign="top"><tt>A</tt> <td valign="top">ASCII alphabetic character required. A-Z, a-z.
663<tr bgcolor="#d0d0d0"> <td valign="top"><tt>a</tt> <td valign="top">ASCII alphabetic character permitted but not required.
664<tr bgcolor="#f0f0f0"> <td valign="top"><tt>N</tt> <td valign="top">ASCII alphanumeric character required. A-Z, a-z, 0-9.
665<tr bgcolor="#d0d0d0"> <td valign="top"><tt>n</tt> <td valign="top">ASCII alphanumeric character permitted but not required.
666<tr bgcolor="#f0f0f0"> <td valign="top"><tt>X</tt> <td valign="top">Any character required.
667<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qwidget.html#x-prop">x</a> <td valign="top">Any character permitted but not required.
668<tr bgcolor="#f0f0f0"> <td valign="top"><tt>9</tt> <td valign="top">ASCII digit required. 0-9.
669<tr bgcolor="#d0d0d0"> <td valign="top"><tt>0</tt> <td valign="top">ASCII digit permitted but not required.
670<tr bgcolor="#f0f0f0"> <td valign="top"><tt>D</tt> <td valign="top">ASCII digit required. 1-9.
671<tr bgcolor="#d0d0d0"> <td valign="top"><tt>d</tt> <td valign="top">ASCII digit permitted but not required (1-9).
672<tr bgcolor="#f0f0f0"> <td valign="top"><tt>#</tt> <td valign="top">ASCII digit or plus/minus sign permitted but not required.
673<tr bgcolor="#d0d0d0"> <td valign="top"><tt>&gt;</tt> <td valign="top">All following alphabetic characters are uppercased.
674<tr bgcolor="#f0f0f0"> <td valign="top"><tt>&lt;</tt> <td valign="top">All following alphabetic characters are lowercased.
675<tr bgcolor="#d0d0d0"> <td valign="top"><tt>!</tt> <td valign="top">Switch off case conversion.
676<tr bgcolor="#f0f0f0"> <td valign="top"><tt>&#92;</tt> <td valign="top">Use <tt>&#92;</tt> to escape the special
677characters listed above to use them as
678separators.
679</table></center>
680<p> The mask consists of a string of mask characters and separators,
681optionally followed by a semi-colon and the character used for
682blanks: the blank characters are always removed from the text
683after editing. The default blank character is space.
684<p> Examples:
685<center><table cellpadding="4" cellspacing="2" border="0">
686<tr bgcolor="#a2c511"> <th valign="top">Mask <th valign="top">Notes
687<tr bgcolor="#d0d0d0"> <td valign="top"><tt>000.000.000.000;_</tt> <td valign="top">IP address; blanks are <tt>_</tt>.
688<tr bgcolor="#f0f0f0"> <td valign="top"><tt>0000-00-00</tt> <td valign="top">ISO Date; blanks are <tt>space</tt>
689<tr bgcolor="#d0d0d0"> <td valign="top"><tt>&gt;AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#</tt> <td valign="top">License number;
690blanks are <tt>-</tt> and all (alphabetic) characters are converted to
691uppercase.
692</table></center>
693<p> To get range control (e.g. for an IP address) use masks together
694with <a href="#setValidator">validators</a>.
695<p> <p>See also <a href="#maxLength-prop">maxLength</a>.
696
697<p>Set this property's value with <a href="#setInputMask">setInputMask</a>() and get this property's value with <a href="#inputMask">inputMask</a>().
698<h3 class=fn><a href="qstring.html">QString</a> <a name="markedText-prop"></a>markedText</h3>
699<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
700<p> <p>This property holds the text selected by the user. Use selectedText instead.
701<p>
702<p>Get this property's value with <a href="#markedText">markedText</a>().
703<h3 class=fn>int <a name="maxLength-prop"></a>maxLength</h3>
704<p>This property holds the maximum permitted length of the text.
705<p>If the text is too long, it is truncated at the limit.
706<p> If truncation occurs any selected text will be unselected, the
707cursor position is set to 0 and the first part of the string is
708shown.
709<p> If the line edit has an input mask, the mask defines the maximum
710string length.
711<p> <p>See also <a href="#inputMask-prop">inputMask</a>.
712
713<p>Set this property's value with <a href="#setMaxLength">setMaxLength</a>() and get this property's value with <a href="#maxLength">maxLength</a>().
714<h3 class=fn>bool <a name="modified-prop"></a>modified</h3>
715<p>This property holds whether the line edit's contents has been modified by the user.
716<p>The modified flag is never read by QLineEdit; it has a default value
717of FALSE and is changed to TRUE whenever the user changes the line
718edit's contents.
719<p> This is useful for things that need to provide a default value but
720do not start out knowing what the default should be (perhaps it
721depends on other fields on the form). Start the line edit without
722the best default, and when the default is known, if modified()
723returns FALSE (the user hasn't entered any text), insert the
724default value.
725<p> Calling <a href="#clearModified">clearModified</a>() or <a href="#setText">setText</a>() resets the modified flag to
726FALSE.
727
728<p>Get this property's value with <a href="#isModified">isModified</a>().
729<h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3>
730<p>This property holds whether the line edit is read only.
731<p>In read-only mode, the user can still copy the text to the
732clipboard or drag-and-drop the text (if <a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>),
733but cannot edit it.
734<p> QLineEdit does not show a cursor in read-only mode.
735<p> <p>See also <a href="qwidget.html#enabled-prop">enabled</a>.
736
737<p>Set this property's value with <a href="#setReadOnly">setReadOnly</a>() and get this property's value with <a href="#isReadOnly">isReadOnly</a>().
738<h3 class=fn>bool <a name="redoAvailable-prop"></a>redoAvailable</h3>
739<p>This property holds whether redo is available.
740<p>
741<p>Get this property's value with <a href="#isRedoAvailable">isRedoAvailable</a>().
742<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText-prop"></a>selectedText</h3>
743<p>This property holds the selected text.
744<p>If there is no selected text this property's value is
745<a href="qstring.html#QString-null">QString::null</a>.
746<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a>.
747
748<p>Get this property's value with <a href="#selectedText">selectedText</a>().
749<h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3>
750<p>This property holds the line edit's text.
751<p>Note that setting this property clears the selection, clears the
752undo/redo history, moves the cursor to the end of the line and
753resets the <a href="#modified-prop">modified</a> property to FALSE. The text is not
754validated when inserted with <a href="#setText">setText</a>().
755<p> The text is truncated to <a href="#maxLength">maxLength</a>() length.
756<p> <p>See also <a href="#insert">insert</a>().
757
758<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
759<h3 class=fn>bool <a name="undoAvailable-prop"></a>undoAvailable</h3>
760<p>This property holds whether undo is available.
761<p>
762<p>Get this property's value with <a href="#isUndoAvailable">isUndoAvailable</a>().
763<!-- eof -->
764<hr><p>
765This file is part of the <a href="index.html">Qt toolkit</a>.
766Copyright &copy; 1995-2007
767<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
768<table width=100% cellspacing=0 border=0><tr>
769<td>Copyright &copy; 2007
770<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
771<td align=right><div align=right>Qt 3.3.8</div>
772</table></div></address></body>
773</html>
Note: See TracBrowser for help on using the repository browser.