~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qlineedit.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/widgets/qlineedit.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QLineEdit Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QLineEdit Class Reference</h1>
 
21
<p>The QLineEdit widget is a one-line text editor. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QLineEdit&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<p>Inherits <a href="qwidget.html">QWidget</a>.</p>
 
24
<ul>
 
25
<li><a href="qlineedit-members.html">List of all members, including inherited members</a></li>
 
26
<li><a href="qlineedit-qt3.html">Qt 3 support members</a></li>
 
27
</ul>
 
28
<a name="public-types"></a>
 
29
<h3>Public Types</h3>
 
30
<ul>
 
31
<li><div class="fn"/>enum <b><a href="qlineedit.html#EchoMode-enum">EchoMode</a></b> { Normal, NoEcho, Password }</li>
 
32
</ul>
 
33
<a name="properties"></a>
 
34
<h3>Properties</h3>
 
35
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 
36
<tr><td width="45%" valign="top"><ul>
 
37
<li><div class="fn"/><b><a href="qlineedit.html#acceptableInput-prop">acceptableInput</a></b> : const bool</li>
 
38
<li><div class="fn"/><b><a href="qlineedit.html#alignment-prop">alignment</a></b> : Qt::Alignment</li>
 
39
<li><div class="fn"/><b><a href="qlineedit.html#cursorPosition-prop">cursorPosition</a></b> : int</li>
 
40
<li><div class="fn"/><b><a href="qlineedit.html#displayText-prop">displayText</a></b> : const QString</li>
 
41
<li><div class="fn"/><b><a href="qlineedit.html#dragEnabled-prop">dragEnabled</a></b> : bool</li>
 
42
<li><div class="fn"/><b><a href="qlineedit.html#echoMode-prop">echoMode</a></b> : EchoMode</li>
 
43
<li><div class="fn"/><b><a href="qlineedit.html#frame-prop">frame</a></b> : bool</li>
 
44
<li><div class="fn"/><b><a href="qlineedit.html#hasSelectedText-prop">hasSelectedText</a></b> : const bool</li>
 
45
</ul></td><td valign="top"><ul>
 
46
<li><div class="fn"/><b><a href="qlineedit.html#inputMask-prop">inputMask</a></b> : QString</li>
 
47
<li><div class="fn"/><b><a href="qlineedit.html#maxLength-prop">maxLength</a></b> : int</li>
 
48
<li><div class="fn"/><b><a href="qlineedit.html#modified-prop">modified</a></b> : bool</li>
 
49
<li><div class="fn"/><b><a href="qlineedit.html#readOnly-prop">readOnly</a></b> : bool</li>
 
50
<li><div class="fn"/><b><a href="qlineedit.html#redoAvailable-prop">redoAvailable</a></b> : const bool</li>
 
51
<li><div class="fn"/><b><a href="qlineedit.html#selectedText-prop">selectedText</a></b> : const QString</li>
 
52
<li><div class="fn"/><b><a href="qlineedit.html#text-prop">text</a></b> : QString</li>
 
53
<li><div class="fn"/><b><a href="qlineedit.html#undoAvailable-prop">undoAvailable</a></b> : const bool</li>
 
54
</ul>
 
55
</td></tr>
 
56
</table>
 
57
<ul>
 
58
<li><div class="fn"/>52 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
 
59
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
60
</ul>
 
61
<a name="public-functions"></a>
 
62
<h3>Public Functions</h3>
 
63
<ul>
 
64
<li><div class="fn"/><b><a href="qlineedit.html#QLineEdit">QLineEdit</a></b> ( QWidget * <i>parent</i> = 0 )</li>
 
65
<li><div class="fn"/><b><a href="qlineedit.html#QLineEdit-2">QLineEdit</a></b> ( const QString &amp; <i>contents</i>, QWidget * <i>parent</i> = 0 )</li>
 
66
<li><div class="fn"/><b><a href="qlineedit.html#dtor.QLineEdit">~QLineEdit</a></b> ()</li>
 
67
<li><div class="fn"/>Qt::Alignment <b><a href="qlineedit.html#alignment-prop">alignment</a></b> () const</li>
 
68
<li><div class="fn"/>void <b><a href="qlineedit.html#backspace">backspace</a></b> ()</li>
 
69
<li><div class="fn"/>QMenu * <b><a href="qlineedit.html#createStandardContextMenu">createStandardContextMenu</a></b> ()</li>
 
70
<li><div class="fn"/>void <b><a href="qlineedit.html#cursorBackward">cursorBackward</a></b> ( bool <i>mark</i>, int <i>steps</i> = 1 )</li>
 
71
<li><div class="fn"/>void <b><a href="qlineedit.html#cursorForward">cursorForward</a></b> ( bool <i>mark</i>, int <i>steps</i> = 1 )</li>
 
72
<li><div class="fn"/>int <b><a href="qlineedit.html#cursorPosition-prop">cursorPosition</a></b> () const</li>
 
73
<li><div class="fn"/>int <b><a href="qlineedit.html#cursorPositionAt">cursorPositionAt</a></b> ( const QPoint &amp; <i>pos</i> )</li>
 
74
<li><div class="fn"/>void <b><a href="qlineedit.html#cursorWordBackward">cursorWordBackward</a></b> ( bool <i>mark</i> )</li>
 
75
<li><div class="fn"/>void <b><a href="qlineedit.html#cursorWordForward">cursorWordForward</a></b> ( bool <i>mark</i> )</li>
 
76
<li><div class="fn"/>void <b><a href="qlineedit.html#del">del</a></b> ()</li>
 
77
<li><div class="fn"/>void <b><a href="qlineedit.html#deselect">deselect</a></b> ()</li>
 
78
<li><div class="fn"/>QString <b><a href="qlineedit.html#displayText-prop">displayText</a></b> () const</li>
 
79
<li><div class="fn"/>bool <b><a href="qlineedit.html#dragEnabled-prop">dragEnabled</a></b> () const</li>
 
80
<li><div class="fn"/>EchoMode <b><a href="qlineedit.html#echoMode-prop">echoMode</a></b> () const</li>
 
81
<li><div class="fn"/>void <b><a href="qlineedit.html#end">end</a></b> ( bool <i>mark</i> )</li>
 
82
<li><div class="fn"/>bool <b><a href="qlineedit.html#acceptableInput-prop">hasAcceptableInput</a></b> () const</li>
 
83
<li><div class="fn"/>bool <b><a href="qlineedit.html#frame-prop">hasFrame</a></b> () const</li>
 
84
<li><div class="fn"/>bool <b><a href="qlineedit.html#hasSelectedText-prop">hasSelectedText</a></b> () const</li>
 
85
<li><div class="fn"/>void <b><a href="qlineedit.html#home">home</a></b> ( bool <i>mark</i> )</li>
 
86
<li><div class="fn"/>QString <b><a href="qlineedit.html#inputMask-prop">inputMask</a></b> () const</li>
 
87
<li><div class="fn"/>void <b><a href="qlineedit.html#insert">insert</a></b> ( const QString &amp; <i>newText</i> )</li>
 
88
<li><div class="fn"/>bool <b><a href="qlineedit.html#modified-prop">isModified</a></b> () const</li>
 
89
<li><div class="fn"/>bool <b><a href="qlineedit.html#readOnly-prop">isReadOnly</a></b> () const</li>
 
90
<li><div class="fn"/>bool <b><a href="qlineedit.html#redoAvailable-prop">isRedoAvailable</a></b> () const</li>
 
91
<li><div class="fn"/>bool <b><a href="qlineedit.html#undoAvailable-prop">isUndoAvailable</a></b> () const</li>
 
92
<li><div class="fn"/>int <b><a href="qlineedit.html#maxLength-prop">maxLength</a></b> () const</li>
 
93
<li><div class="fn"/>virtual QSize <b><a href="qlineedit.html#minimumSizeHint">minimumSizeHint</a></b> () const</li>
 
94
<li><div class="fn"/>QString <b><a href="qlineedit.html#selectedText-prop">selectedText</a></b> () const</li>
 
95
<li><div class="fn"/>int <b><a href="qlineedit.html#selectionStart">selectionStart</a></b> () const</li>
 
96
<li><div class="fn"/>void <b><a href="qlineedit.html#alignment-prop">setAlignment</a></b> ( Qt::Alignment <i>flag</i> )</li>
 
97
<li><div class="fn"/>void <b><a href="qlineedit.html#cursorPosition-prop">setCursorPosition</a></b> ( int )</li>
 
98
<li><div class="fn"/>void <b><a href="qlineedit.html#dragEnabled-prop">setDragEnabled</a></b> ( bool <i>b</i> )</li>
 
99
<li><div class="fn"/>void <b><a href="qlineedit.html#echoMode-prop">setEchoMode</a></b> ( EchoMode )</li>
 
100
<li><div class="fn"/>void <b><a href="qlineedit.html#frame-prop">setFrame</a></b> ( bool )</li>
 
101
<li><div class="fn"/>void <b><a href="qlineedit.html#inputMask-prop">setInputMask</a></b> ( const QString &amp; <i>inputMask</i> )</li>
 
102
<li><div class="fn"/>void <b><a href="qlineedit.html#maxLength-prop">setMaxLength</a></b> ( int )</li>
 
103
<li><div class="fn"/>void <b><a href="qlineedit.html#modified-prop">setModified</a></b> ( bool )</li>
 
104
<li><div class="fn"/>void <b><a href="qlineedit.html#readOnly-prop">setReadOnly</a></b> ( bool )</li>
 
105
<li><div class="fn"/>void <b><a href="qlineedit.html#setSelection">setSelection</a></b> ( int <i>start</i>, int <i>length</i> )</li>
 
106
<li><div class="fn"/>void <b><a href="qlineedit.html#setValidator">setValidator</a></b> ( const QValidator * <i>v</i> )</li>
 
107
<li><div class="fn"/>virtual QSize <b><a href="qlineedit.html#sizeHint">sizeHint</a></b> () const</li>
 
108
<li><div class="fn"/>QString <b><a href="qlineedit.html#text-prop">text</a></b> () const</li>
 
109
<li><div class="fn"/>const QValidator * <b><a href="qlineedit.html#validator">validator</a></b> () const</li>
 
110
</ul>
 
111
<ul>
 
112
<li><div class="fn"/>183 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
 
113
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
114
<li><div class="fn"/>10 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
 
115
</ul>
 
116
<a name="public-slots"></a>
 
117
<h3>Public Slots</h3>
 
118
<ul>
 
119
<li><div class="fn"/>void <b><a href="qlineedit.html#clear">clear</a></b> ()</li>
 
120
<li><div class="fn"/>void <b><a href="qlineedit.html#copy">copy</a></b> () const</li>
 
121
<li><div class="fn"/>void <b><a href="qlineedit.html#cut">cut</a></b> ()</li>
 
122
<li><div class="fn"/>void <b><a href="qlineedit.html#paste">paste</a></b> ()</li>
 
123
<li><div class="fn"/>void <b><a href="qlineedit.html#redo">redo</a></b> ()</li>
 
124
<li><div class="fn"/>void <b><a href="qlineedit.html#selectAll">selectAll</a></b> ()</li>
 
125
<li><div class="fn"/>void <b><a href="qlineedit.html#text-prop">setText</a></b> ( const QString &amp; )</li>
 
126
<li><div class="fn"/>void <b><a href="qlineedit.html#undo">undo</a></b> ()</li>
 
127
</ul>
 
128
<ul>
 
129
<li><div class="fn"/>17 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
 
130
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
131
</ul>
 
132
<a name="signals"></a>
 
133
<h3>Signals</h3>
 
134
<ul>
 
135
<li><div class="fn"/>void <b><a href="qlineedit.html#cursorPositionChanged">cursorPositionChanged</a></b> ( int <i>old</i>, int <i>new</i> )</li>
 
136
<li><div class="fn"/>void <b><a href="qlineedit.html#editingFinished">editingFinished</a></b> ()</li>
 
137
<li><div class="fn"/>void <b><a href="qlineedit.html#returnPressed">returnPressed</a></b> ()</li>
 
138
<li><div class="fn"/>void <b><a href="qlineedit.html#selectionChanged">selectionChanged</a></b> ()</li>
 
139
<li><div class="fn"/>void <b><a href="qlineedit.html#textChanged">textChanged</a></b> ( const QString &amp; <i>text</i> )</li>
 
140
<li><div class="fn"/>void <b><a href="qlineedit.html#textEdited">textEdited</a></b> ( const QString &amp; <i>text</i> )</li>
 
141
</ul>
 
142
<ul>
 
143
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
 
144
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
145
</ul>
 
146
<a name="protected-functions"></a>
 
147
<h3>Protected Functions</h3>
 
148
<ul>
 
149
<li><div class="fn"/>virtual void <b><a href="qlineedit.html#contextMenuEvent">contextMenuEvent</a></b> ( QContextMenuEvent * <i>event</i> )</li>
 
150
<li><div class="fn"/>virtual void <b><a href="qlineedit.html#keyPressEvent">keyPressEvent</a></b> ( QKeyEvent * <i>event</i> )</li>
 
151
</ul>
 
152
<ul>
 
153
<li><div class="fn"/>39 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
 
154
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
155
</ul>
 
156
<h3>Additional Inherited Members</h3>
 
157
<ul>
 
158
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
 
159
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
160
</ul>
 
161
<a name="details"></a>
 
162
<hr />
 
163
<h2>Detailed Description</h2>
 
164
<p>The QLineEdit widget is a one-line text editor.</p>
 
165
<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>
 
166
<p>By changing the <a href="qlineedit.html#echoMode-prop">echoMode</a>() of a line edit, it can also be used as a &quot;write-only&quot; field, for inputs such as passwords.</p>
 
167
<p>The length of the text can be constrained to <a href="qlineedit.html#maxLength-prop">maxLength</a>(). The text can be arbitrarily constrained using a <a href="qlineedit.html#validator">validator</a>() or an <a href="qlineedit.html#inputMask-prop">inputMask</a>(), or both.</p>
 
168
<p>A related class is <a href="qtextedit.html">QTextEdit</a> which allows multi-line, rich text editing.</p>
 
169
<p>You can change the text with <a href="qlineedit.html#text-prop">setText</a>() or <a href="qlineedit.html#insert">insert</a>(). The text is retrieved with <a href="qlineedit.html#text-prop">text</a>(); the displayed text (which may be different, see <a href="qlineedit.html#EchoMode-enum">EchoMode</a>) is retrieved with <a href="qlineedit.html#displayText-prop">displayText</a>(). Text can be selected with <a href="qlineedit.html#setSelection">setSelection</a>() or <a href="qlineedit.html#selectAll">selectAll</a>(), and the selection can be <a href="qlineedit.html#cut">cut</a>(), <a href="qlineedit.html#copy">copy</a>()ied and <a href="qlineedit.html#paste">paste</a>()d. The text can be aligned with <a href="qlineedit.html#alignment-prop">setAlignment</a>().</p>
 
170
<p>When the text changes the <a href="qlineedit.html#textChanged">textChanged</a>() signal is emitted; when the text changes other than by calling <a href="qlineedit.html#text-prop">setText</a>() the <a href="qlineedit.html#textEdited">textEdited</a>() signal is emitted; when the cursor is moved the <a href="qlineedit.html#cursorPositionChanged">cursorPositionChanged</a>() signal is emitted; and when the Return or Enter key is pressed the <a href="qlineedit.html#returnPressed">returnPressed</a>() signal is emitted.</p>
 
171
<p>When editing is finished, either because the line edit lost focus or Return/Enter is pressed the <a href="qlineedit.html#editingFinished">editingFinished</a>() signal is emitted.</p>
 
172
<p>Note that if there is a validator set on the line edit, the <a href="qlineedit.html#returnPressed">returnPressed</a>()/<a href="qlineedit.html#editingFinished">editingFinished</a>() signals will only be emitted if the validator returns <tt>Acceptable</tt>.</p>
 
173
<p>By default, QLineEdits have a frame as specified by the Windows and Motif style guides; you can turn it off by calling setFrame(false).</p>
 
174
<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></p>
 
175
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
176
<tr valign="top" bgcolor="#a2c511"><th>Keypress</th><th>Action</th></tr>
 
177
<tr valign="top" bgcolor="#f0f0f0"><td>Left Arrow</td><td>Moves the cursor one character to the left.</td></tr>
 
178
<tr valign="top" bgcolor="#e0e0e0"><td>Shift+Left Arrow</td><td>Moves and selects text one character to the left.</td></tr>
 
179
<tr valign="top" bgcolor="#f0f0f0"><td>Right Arrow</td><td>Moves the cursor one character to the right.</td></tr>
 
180
<tr valign="top" bgcolor="#e0e0e0"><td>Shift+Right Arrow</td><td>Moves and selects text one character to the right.</td></tr>
 
181
<tr valign="top" bgcolor="#f0f0f0"><td>Home</td><td>Moves the cursor to the beginning of the line.</td></tr>
 
182
<tr valign="top" bgcolor="#e0e0e0"><td>End</td><td>Moves the cursor to the end of the line.</td></tr>
 
183
<tr valign="top" bgcolor="#f0f0f0"><td>Backspace</td><td>Deletes the character to the left of the cursor.</td></tr>
 
184
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+Backspace</td><td>Deletes the word to the left of the cursor.</td></tr>
 
185
<tr valign="top" bgcolor="#f0f0f0"><td>Delete</td><td>Deletes the character to the right of the cursor.</td></tr>
 
186
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+Delete</td><td>Deletes the word to the right of the cursor.</td></tr>
 
187
<tr valign="top" bgcolor="#f0f0f0"><td>Ctrl+A</td><td>Moves the cursor to the beginning of the line.</td></tr>
 
188
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+B</td><td>Moves the cursor one character to the left.</td></tr>
 
189
<tr valign="top" bgcolor="#f0f0f0"><td>Ctrl+C</td><td>Copies the selected text to the clipboard.</td></tr>
 
190
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+Insert</td><td>Copies the selected text to the clipboard.</td></tr>
 
191
<tr valign="top" bgcolor="#f0f0f0"><td>Ctrl+D</td><td>Deletes the character to the right of the cursor.</td></tr>
 
192
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+E</td><td>Moves the cursor to the end of the line.</td></tr>
 
193
<tr valign="top" bgcolor="#f0f0f0"><td>Ctrl+F</td><td>Moves the cursor one character to the right.</td></tr>
 
194
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+H</td><td>Deletes the character to the left of the cursor.</td></tr>
 
195
<tr valign="top" bgcolor="#f0f0f0"><td>Ctrl+K</td><td>Deletes to the end of the line.</td></tr>
 
196
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+V</td><td>Pastes the clipboard text into line edit.</td></tr>
 
197
<tr valign="top" bgcolor="#f0f0f0"><td>Shift+Insert</td><td>Pastes the clipboard text into line edit.</td></tr>
 
198
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+X</td><td>Deletes the selected text and copies it to the clipboard.</td></tr>
 
199
<tr valign="top" bgcolor="#f0f0f0"><td>Shift+Delete</td><td>Deletes the selected text and copies it to the clipboard.</td></tr>
 
200
<tr valign="top" bgcolor="#e0e0e0"><td>Ctrl+Z</td><td>Undoes the last operation.</td></tr>
 
201
<tr valign="top" bgcolor="#f0f0f0"><td>Ctrl+Y</td><td>Redoes the last undone operation.</td></tr>
 
202
</table>
 
203
<p>Any other key sequence that represents a valid character, will cause the character to be inserted into the line edit.</p>
 
204
<p><img src="images/macintosh-lineedit.png" alt="Screenshot in Macintosh style" /> <img src="images/windows-lineedit.png" alt="Screenshot in Windows style" /></p>
 
205
<p>See also <a href="qtextedit.html">QTextEdit</a>, <a href="qlabel.html">QLabel</a>, <a href="qcombobox.html">QComboBox</a>, and <a href="guibooks.html#fowler">GUI Design Handbook: Field, Entry</a>.</p>
 
206
<hr />
 
207
<h2>Member Type Documentation</h2>
 
208
<h3 class="fn"><a name="EchoMode-enum"></a>enum QLineEdit::EchoMode</h3>
 
209
<p>This enum type describes how a line edit should display its contents.</p>
 
210
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
211
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
212
<tr><td valign="top"><tt>QLineEdit::Normal</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Display characters as they are entered. This is the default.</td></tr>
 
213
<tr><td valign="top"><tt>QLineEdit::NoEcho</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret.</td></tr>
 
214
<tr><td valign="top"><tt>QLineEdit::Password</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Display asterisks instead of the characters actually entered.</td></tr>
 
215
</table>
 
216
<p>See also <a href="qlineedit.html#echoMode-prop">setEchoMode</a>() and <a href="qlineedit.html#echoMode-prop">echoMode</a>().</p>
 
217
<hr />
 
218
<h2>Property Documentation</h2>
 
219
<h3 class="fn"><a name="acceptableInput-prop"></a>acceptableInput : const bool</h3>
 
220
<p>This property holds whether the input satisfies the inputMask and the validator.</p>
 
221
<p>Access functions:</p>
 
222
<ul>
 
223
<li><div class="fn"/><b>bool hasAcceptableInput () const</b></li>
 
224
</ul>
 
225
<p>See also <a href="qlineedit.html#inputMask-prop">setInputMask</a>() and <a href="qlineedit.html#setValidator">setValidator</a>().</p>
 
226
<h3 class="fn"><a name="alignment-prop"></a>alignment : <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></h3>
 
227
<p>This property holds the alignment of the line edit.</p>
 
228
<p>Only horizontal alignments are allowed in here, <a href="qt.html#AlignmentFlag-enum">Qt::AlignJustify</a> will map to <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>.</p>
 
229
<p>Access functions:</p>
 
230
<ul>
 
231
<li><div class="fn"/><b>Qt::Alignment alignment () const</b></li>
 
232
<li><div class="fn"/><b>void setAlignment ( Qt::Alignment <i>flag</i> )</b></li>
 
233
</ul>
 
234
<p>See also <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a>.</p>
 
235
<h3 class="fn"><a name="cursorPosition-prop"></a>cursorPosition : int</h3>
 
236
<p>This property holds the current cursor position for this line edit.</p>
 
237
<p>Setting the cursor position causes a repaint when appropriate.</p>
 
238
<p>Access functions:</p>
 
239
<ul>
 
240
<li><div class="fn"/><b>int cursorPosition () const</b></li>
 
241
<li><div class="fn"/><b>void setCursorPosition ( int )</b></li>
 
242
</ul>
 
243
<h3 class="fn"><a name="displayText-prop"></a>displayText : const <a href="qstring.html">QString</a></h3>
 
244
<p>This property holds the displayed text.</p>
 
245
<p>If <tt>EchoMode</tt> is <tt>Normal</tt> this returns the same as <a href="qlineedit.html#text-prop">text</a>(); if <tt>EchoMode</tt> is <tt>Password</tt> it returns a string of asterisks <a href="qlineedit.html#text-prop">text</a>().length() characters long, e.g. &quot;******&quot;; if <tt>EchoMode</tt> is <tt>NoEcho</tt> returns an empty string, &quot;&quot;.</p>
 
246
<p>Access functions:</p>
 
247
<ul>
 
248
<li><div class="fn"/><b>QString displayText () const</b></li>
 
249
</ul>
 
250
<p>See also <a href="qlineedit.html#echoMode-prop">setEchoMode</a>(), <a href="qlineedit.html#text-prop">text</a>(), and <a href="qlineedit.html#EchoMode-enum">EchoMode</a>.</p>
 
251
<h3 class="fn"><a name="dragEnabled-prop"></a>dragEnabled : bool</h3>
 
252
<p>This property holds whether the lineedit starts a drag if the user presses and moves the mouse on some selected text.</p>
 
253
<p>Dragging is disabled by default.</p>
 
254
<p>Access functions:</p>
 
255
<ul>
 
256
<li><div class="fn"/><b>bool dragEnabled () const</b></li>
 
257
<li><div class="fn"/><b>void setDragEnabled ( bool <i>b</i> )</b></li>
 
258
</ul>
 
259
<h3 class="fn"><a name="echoMode-prop"></a>echoMode : <a href="qlineedit.html#EchoMode-enum">EchoMode</a></h3>
 
260
<p>This property holds the line edit's echo mode.</p>
 
261
<p>The initial setting is <tt>Normal</tt>, but <a href="qlineedit.html">QLineEdit</a> also supports <tt>NoEcho</tt> and <tt>Password</tt> modes.</p>
 
262
<p>The widget's display and the ability to copy or drag the text is affected by this setting.</p>
 
263
<p>Access functions:</p>
 
264
<ul>
 
265
<li><div class="fn"/><b>EchoMode echoMode () const</b></li>
 
266
<li><div class="fn"/><b>void setEchoMode ( EchoMode )</b></li>
 
267
</ul>
 
268
<p>See also <a href="qlineedit.html#EchoMode-enum">EchoMode</a> and <a href="qlineedit.html#displayText-prop">displayText</a>().</p>
 
269
<h3 class="fn"><a name="frame-prop"></a>frame : bool</h3>
 
270
<p>This property holds whether the line edit draws itself with a frame.</p>
 
271
<p>If enabled (the default) the line edit draws itself inside a frame, otherwise the line edit draws itself without any frame.</p>
 
272
<p>Access functions:</p>
 
273
<ul>
 
274
<li><div class="fn"/><b>bool hasFrame () const</b></li>
 
275
<li><div class="fn"/><b>void setFrame ( bool )</b></li>
 
276
</ul>
 
277
<h3 class="fn"><a name="hasSelectedText-prop"></a>hasSelectedText : const bool</h3>
 
278
<p>This property holds whether there is any text selected.</p>
 
279
<p>hasSelectedText() returns true if some or all of the text has been selected by the user; otherwise returns false.</p>
 
280
<p>Access functions:</p>
 
281
<ul>
 
282
<li><div class="fn"/><b>bool hasSelectedText () const</b></li>
 
283
</ul>
 
284
<p>See also <a href="qlineedit.html#selectedText-prop">selectedText</a>().</p>
 
285
<h3 class="fn"><a name="inputMask-prop"></a>inputMask : <a href="qstring.html">QString</a></h3>
 
286
<p>This property holds the validation input mask.</p>
 
287
<p>If no mask is set, inputMask() returns an empty string.</p>
 
288
<p>Sets the <a href="qlineedit.html">QLineEdit</a>'s validation mask. Validators can be used instead of, or in conjunction with masks; see <a href="qlineedit.html#setValidator">setValidator</a>().</p>
 
289
<p>Unset the mask and return to normal <a href="qlineedit.html">QLineEdit</a> operation by passing an empty string (&quot;&quot;) or just calling setInputMask() with no arguments.</p>
 
290
<p>The mask format understands these mask characters:</p>
 
291
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
292
<tr valign="top" bgcolor="#a2c511"><th>Character</th><th>Meaning</th></tr>
 
293
<tr valign="top" bgcolor="#f0f0f0"><td><tt>A</tt></td><td>ASCII alphabetic character required. A-Z, a-z.</td></tr>
 
294
<tr valign="top" bgcolor="#e0e0e0"><td><tt>a</tt></td><td>ASCII alphabetic character permitted but not required.</td></tr>
 
295
<tr valign="top" bgcolor="#f0f0f0"><td><tt>N</tt></td><td>ASCII alphanumeric character required. A-Z, a-z, 0-9.</td></tr>
 
296
<tr valign="top" bgcolor="#e0e0e0"><td><tt>n</tt></td><td>ASCII alphanumeric character permitted but not required.</td></tr>
 
297
<tr valign="top" bgcolor="#f0f0f0"><td><tt>X</tt></td><td>Any character required.</td></tr>
 
298
<tr valign="top" bgcolor="#e0e0e0"><td><tt>x</tt></td><td>Any character permitted but not required.</td></tr>
 
299
<tr valign="top" bgcolor="#f0f0f0"><td><tt>9</tt></td><td>ASCII digit required. 0-9.</td></tr>
 
300
<tr valign="top" bgcolor="#e0e0e0"><td><tt>0</tt></td><td>ASCII digit permitted but not required.</td></tr>
 
301
<tr valign="top" bgcolor="#f0f0f0"><td><tt>D</tt></td><td>ASCII digit required. 1-9.</td></tr>
 
302
<tr valign="top" bgcolor="#e0e0e0"><td><tt>d</tt></td><td>ASCII digit permitted but not required (1-9).</td></tr>
 
303
<tr valign="top" bgcolor="#f0f0f0"><td><tt>#</tt></td><td>ASCII digit or plus/minus sign permitted but not required.</td></tr>
 
304
<tr valign="top" bgcolor="#e0e0e0"><td><tt>&gt;</tt></td><td>All following alphabetic characters are uppercased.</td></tr>
 
305
<tr valign="top" bgcolor="#f0f0f0"><td><tt>&lt;</tt></td><td>All following alphabetic characters are lowercased.</td></tr>
 
306
<tr valign="top" bgcolor="#e0e0e0"><td><tt>!</tt></td><td>Switch off case conversion.</td></tr>
 
307
<tr valign="top" bgcolor="#f0f0f0"><td>&lt;tt&gt;\&lt;/tt&gt;</td><td>Use &lt;tt&gt;\&lt;/tt&gt; to escape the special characters listed above to use them as separators.</td></tr>
 
308
</table>
 
309
<p>The mask consists of a string of mask characters and separators, optionally followed by a semicolon and the character used for blanks: the blank characters are always removed from the text after editing. The default blank character is space.</p>
 
310
<p>Examples:</p>
 
311
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
312
<tr valign="top" bgcolor="#a2c511"><th>Mask</th><th>Notes</th></tr>
 
313
<tr valign="top" bgcolor="#f0f0f0"><td><tt>000.000.000.000;_</tt></td><td>IP address; blanks are <tt>_</tt>.</td></tr>
 
314
<tr valign="top" bgcolor="#e0e0e0"><td><tt>0000-00-00</tt></td><td>ISO Date; blanks are <tt>space</tt></td></tr>
 
315
<tr valign="top" bgcolor="#f0f0f0"><td><tt>&gt;AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#</tt></td><td>License number; blanks are <tt>-</tt> and all (alphabetic) characters are converted to uppercase.</td></tr>
 
316
</table>
 
317
<p>To get range control (e.g. for an IP address) use masks together with <a href="qlineedit.html#setValidator">validators</a>.</p>
 
318
<p>Access functions:</p>
 
319
<ul>
 
320
<li><div class="fn"/><b>QString inputMask () const</b></li>
 
321
<li><div class="fn"/><b>void setInputMask ( const QString &amp; <i>inputMask</i> )</b></li>
 
322
</ul>
 
323
<p>See also <a href="qlineedit.html#maxLength-prop">maxLength</a>.</p>
 
324
<h3 class="fn"><a name="maxLength-prop"></a>maxLength : int</h3>
 
325
<p>This property holds the maximum permitted length of the text.</p>
 
326
<p>If the text is too long, it is truncated at the limit.</p>
 
327
<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>
 
328
<p>If the line edit has an input mask, the mask defines the maximum string length.</p>
 
329
<p>Access functions:</p>
 
330
<ul>
 
331
<li><div class="fn"/><b>int maxLength () const</b></li>
 
332
<li><div class="fn"/><b>void setMaxLength ( int )</b></li>
 
333
</ul>
 
334
<p>See also <a href="qlineedit.html#inputMask-prop">inputMask</a>.</p>
 
335
<h3 class="fn"><a name="modified-prop"></a>modified : bool</h3>
 
336
<p>This property holds whether the line edit's contents has been modified by the user.</p>
 
337
<p>The modified flag is never read by <a href="qlineedit.html">QLineEdit</a>; it has a default value of false and is changed to true whenever the user changes the line edit's contents.</p>
 
338
<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>
 
339
<p>Calling <a href="qlineedit.html#text-prop">setText</a>() resets the modified flag to false.</p>
 
340
<p>Access functions:</p>
 
341
<ul>
 
342
<li><div class="fn"/><b>bool isModified () const</b></li>
 
343
<li><div class="fn"/><b>void setModified ( bool )</b></li>
 
344
</ul>
 
345
<h3 class="fn"><a name="readOnly-prop"></a>readOnly : bool</h3>
 
346
<p>This property holds whether the line edit is read only.</p>
 
347
<p>In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text (if <a href="qlineedit.html#echoMode-prop">echoMode</a>() is <tt>Normal</tt>), but cannot edit it.</p>
 
348
<p><a href="qlineedit.html">QLineEdit</a> does not show a cursor in read-only mode.</p>
 
349
<p>Access functions:</p>
 
350
<ul>
 
351
<li><div class="fn"/><b>bool isReadOnly () const</b></li>
 
352
<li><div class="fn"/><b>void setReadOnly ( bool )</b></li>
 
353
</ul>
 
354
<p>See also <a href="qwidget.html#enabled-prop">setEnabled</a>().</p>
 
355
<h3 class="fn"><a name="redoAvailable-prop"></a>redoAvailable : const bool</h3>
 
356
<p>This property holds whether redo is available.</p>
 
357
<p>Access functions:</p>
 
358
<ul>
 
359
<li><div class="fn"/><b>bool isRedoAvailable () const</b></li>
 
360
</ul>
 
361
<h3 class="fn"><a name="selectedText-prop"></a>selectedText : const <a href="qstring.html">QString</a></h3>
 
362
<p>This property holds the selected text.</p>
 
363
<p>If there is no selected text this property's value is an empty string.</p>
 
364
<p>Access functions:</p>
 
365
<ul>
 
366
<li><div class="fn"/><b>QString selectedText () const</b></li>
 
367
</ul>
 
368
<p>See also <a href="qlineedit.html#hasSelectedText-prop">hasSelectedText</a>().</p>
 
369
<h3 class="fn"><a name="text-prop"></a>text : <a href="qstring.html">QString</a></h3>
 
370
<p>This property holds the line edit's text.</p>
 
371
<p>Setting this property clears the selection, clears the undo/redo history, moves the cursor to the end of the line and resets the <tt>modified</tt> property to false. The text is not validated when inserted with setText().</p>
 
372
<p>The text is truncated to <a href="qlineedit.html#maxLength-prop">maxLength</a>() length.</p>
 
373
<p>Access functions:</p>
 
374
<ul>
 
375
<li><div class="fn"/><b>QString text () const</b></li>
 
376
<li><div class="fn"/><b>void setText ( const QString &amp; )</b></li>
 
377
</ul>
 
378
<p>See also <a href="qlineedit.html#insert">insert</a>() and <a href="qlineedit.html#clear">clear</a>().</p>
 
379
<h3 class="fn"><a name="undoAvailable-prop"></a>undoAvailable : const bool</h3>
 
380
<p>This property holds whether undo is available.</p>
 
381
<p>Access functions:</p>
 
382
<ul>
 
383
<li><div class="fn"/><b>bool isUndoAvailable () const</b></li>
 
384
</ul>
 
385
<hr />
 
386
<h2>Member Function Documentation</h2>
 
387
<h3 class="fn"><a name="QLineEdit"></a>QLineEdit::QLineEdit ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
 
388
<p>Constructs a line edit with no text.</p>
 
389
<p>The maximum text length is set to 32767 characters.</p>
 
390
<p>The <i>parent</i> argument is sent to the <a href="qwidget.html">QWidget</a> constructor.</p>
 
391
<p>See also <a href="qlineedit.html#text-prop">setText</a>() and <a href="qlineedit.html#maxLength-prop">setMaxLength</a>().</p>
 
392
<h3 class="fn"><a name="QLineEdit-2"></a>QLineEdit::QLineEdit ( const <a href="qstring.html">QString</a> &amp; <i>contents</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
 
393
<p>Constructs a line edit containing the text <i>contents</i>.</p>
 
394
<p>The cursor position is set to the end of the line and the maximum text length to 32767 characters.</p>
 
395
<p>The <i>parent</i> and argument is sent to the <a href="qwidget.html">QWidget</a> constructor.</p>
 
396
<p>See also <a href="qlineedit.html#text-prop">text</a>() and <a href="qlineedit.html#maxLength-prop">setMaxLength</a>().</p>
 
397
<h3 class="fn"><a name="dtor.QLineEdit"></a>QLineEdit::~QLineEdit ()</h3>
 
398
<p>Destroys the line edit.</p>
 
399
<h3 class="fn"><a name="backspace"></a>void QLineEdit::backspace ()</h3>
 
400
<p>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>
 
401
<p>See also <a href="qlineedit.html#del">del</a>().</p>
 
402
<h3 class="fn"><a name="clear"></a>void QLineEdit::clear ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
403
<p>Clears the contents of the line edit.</p>
 
404
<p>See also <a href="qlineedit.html#text-prop">setText</a>() and <a href="qlineedit.html#insert">insert</a>().</p>
 
405
<h3 class="fn"><a name="contextMenuEvent"></a>void QLineEdit::contextMenuEvent ( <a href="qcontextmenuevent.html">QContextMenuEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
406
<p>Shows the standard context menu created with <a href="qlineedit.html#createStandardContextMenu">createStandardContextMenu</a>().</p>
 
407
<p>If you do not want the line edit to have a context menu, you can set its <a href="qwidget.html#contextMenuPolicy-prop">contextMenuPolicy</a> to <a href="qt.html#ContextMenuPolicy-enum">Qt::NoContextMenu</a>. If you want to customize the context menu, reimplement this function. If you want to extend the standard context menu, reimplement this function, call <a href="qlineedit.html#createStandardContextMenu">createStandardContextMenu</a>() and extend the menu returned.</p>
 
408
<pre>&nbsp;   void LineEdit::contextMenuEvent(QContextMenuEvent *event)
 
409
    {
 
410
        QMenu *menu = createStandardContextMenu();
 
411
        menu-&gt;addAction(tr(&quot;My Menu Item&quot;));
 
412
        //...
 
413
        menu-&gt;exec(event-&gt;globalPos());
 
414
        delete menu;
 
415
    }</pre>
 
416
<p>The <i>event</i> parameter is used to obtain the position where the mouse cursor was when the event was generated.</p>
 
417
<p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget</a>.</p>
 
418
<p>See also <a href="qwidget.html#contextMenuPolicy-prop">setContextMenuPolicy</a>().</p>
 
419
<h3 class="fn"><a name="copy"></a>void QLineEdit::copy () const&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
420
<p>Copies the selected text to the clipboard, if there is any, and if <a href="qlineedit.html#echoMode-prop">echoMode</a>() is <tt>Normal</tt>.</p>
 
421
<p>See also <a href="qlineedit.html#cut">cut</a>() and <a href="qlineedit.html#paste">paste</a>().</p>
 
422
<h3 class="fn"><a name="createStandardContextMenu"></a><a href="qmenu.html">QMenu</a> * QLineEdit::createStandardContextMenu ()</h3>
 
423
<p>This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse button. It is called from the default <a href="qlineedit.html#contextMenuEvent">contextMenuEvent</a>() handler. The popup menu's ownership is transferred to the caller.</p>
 
424
<h3 class="fn"><a name="cursorBackward"></a>void QLineEdit::cursorBackward ( bool <i>mark</i>, int <i>steps</i> = 1 )</h3>
 
425
<p>Moves the cursor back <i>steps</i> characters. If <i>mark</i> is true each character moved over is added to the selection; if <i>mark</i> is false the selection is cleared.</p>
 
426
<p>See also <a href="qlineedit.html#cursorForward">cursorForward</a>().</p>
 
427
<h3 class="fn"><a name="cursorForward"></a>void QLineEdit::cursorForward ( bool <i>mark</i>, int <i>steps</i> = 1 )</h3>
 
428
<p>Moves the cursor forward <i>steps</i> characters. If <i>mark</i> is true each character moved over is added to the selection; if <i>mark</i> is false the selection is cleared.</p>
 
429
<p>See also <a href="qlineedit.html#cursorBackward">cursorBackward</a>().</p>
 
430
<h3 class="fn"><a name="cursorPositionAt"></a>int QLineEdit::cursorPositionAt ( const <a href="qpoint.html">QPoint</a> &amp; <i>pos</i> )</h3>
 
431
<p>Returns the <tt>cursorPostion</tt> under the point <i>pos</i>.</p>
 
432
<h3 class="fn"><a name="cursorPositionChanged"></a>void QLineEdit::cursorPositionChanged ( int <i>old</i>, int <i>new</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
433
<p>This signal is emitted whenever the cursor moves. The previous position is given by <i>old</i>, and the new position by <i>new</i>.</p>
 
434
<p>See also <a href="qlineedit.html#cursorPosition-prop">setCursorPosition</a>() and <a href="qlineedit.html#cursorPosition-prop">cursorPosition</a>().</p>
 
435
<h3 class="fn"><a name="cursorWordBackward"></a>void QLineEdit::cursorWordBackward ( bool <i>mark</i> )</h3>
 
436
<p>Moves the cursor one word backward. If <i>mark</i> is true, the word is also selected.</p>
 
437
<p>See also <a href="qlineedit.html#cursorWordForward">cursorWordForward</a>().</p>
 
438
<h3 class="fn"><a name="cursorWordForward"></a>void QLineEdit::cursorWordForward ( bool <i>mark</i> )</h3>
 
439
<p>Moves the cursor one word forward. If <i>mark</i> is true, the word is also selected.</p>
 
440
<p>See also <a href="qlineedit.html#cursorWordBackward">cursorWordBackward</a>().</p>
 
441
<h3 class="fn"><a name="cut"></a>void QLineEdit::cut ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
442
<p>Copies the selected text to the clipboard and deletes it, if there is any, and if <a href="qlineedit.html#echoMode-prop">echoMode</a>() is <tt>Normal</tt>.</p>
 
443
<p>If the current validator disallows deleting the selected text, cut() will copy without deleting.</p>
 
444
<p>See also <a href="qlineedit.html#copy">copy</a>(), <a href="qlineedit.html#paste">paste</a>(), and <a href="qlineedit.html#setValidator">setValidator</a>().</p>
 
445
<h3 class="fn"><a name="del"></a>void QLineEdit::del ()</h3>
 
446
<p>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>
 
447
<p>See also <a href="qlineedit.html#backspace">backspace</a>().</p>
 
448
<h3 class="fn"><a name="deselect"></a>void QLineEdit::deselect ()</h3>
 
449
<p>Deselects any selected text.</p>
 
450
<p>See also <a href="qlineedit.html#setSelection">setSelection</a>() and <a href="qlineedit.html#selectAll">selectAll</a>().</p>
 
451
<h3 class="fn"><a name="editingFinished"></a>void QLineEdit::editingFinished ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
452
<p>This signal is emitted when the Return or Enter key is pressed or the line edit looses focus. Note that if there is a <a href="qlineedit.html#validator">validator</a>() or <a href="qlineedit.html#inputMask-prop">inputMask</a>() set on the line edit and enter/return is pressed, the editingFinished() signal will only be emitted if the input follows the <a href="qlineedit.html#inputMask-prop">inputMask</a>() and the <a href="qlineedit.html#validator">validator</a>() returns <tt>Acceptable</tt>.</p>
 
453
<h3 class="fn"><a name="end"></a>void QLineEdit::end ( bool <i>mark</i> )</h3>
 
454
<p>Moves the text cursor to the end of the line unless it is already there. If <i>mark</i> is true, text is selected towards the last position; otherwise, any selected text is unselected if the cursor is moved.</p>
 
455
<p>See also <a href="qlineedit.html#home">home</a>().</p>
 
456
<h3 class="fn"><a name="home"></a>void QLineEdit::home ( bool <i>mark</i> )</h3>
 
457
<p>Moves the text cursor to the beginning of the line unless it is already there. If <i>mark</i> is true, text is selected towards the first position; otherwise, any selected text is unselected if the cursor is moved.</p>
 
458
<p>See also <a href="qlineedit.html#end">end</a>().</p>
 
459
<h3 class="fn"><a name="insert"></a>void QLineEdit::insert ( const <a href="qstring.html">QString</a> &amp; <i>newText</i> )</h3>
 
460
<p>Deletes any selected text, inserts <i>newText</i>, and validates the result. If it is valid, it sets it as the new contents of the line edit.</p>
 
461
<p>See also <a href="qlineedit.html#text-prop">setText</a>() and <a href="qlineedit.html#clear">clear</a>().</p>
 
462
<h3 class="fn"><a name="keyPressEvent"></a>void QLineEdit::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
463
<p>Converts the given key press <i>event</i> into a line edit action.</p>
 
464
<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="qlineedit.html#returnPressed">returnPressed</a>() is emitted.</p>
 
465
<p>The default key bindings are listed in the class's detailed description.</p>
 
466
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget</a>.</p>
 
467
<h3 class="fn"><a name="minimumSizeHint"></a><a href="qsize.html">QSize</a> QLineEdit::minimumSizeHint () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
468
<p>Returns a minimum size for the line edit.</p>
 
469
<p>The width returned is enough for at least one character.</p>
 
470
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget</a>.</p>
 
471
<h3 class="fn"><a name="paste"></a>void QLineEdit::paste ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
472
<p>Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not <a href="qlineedit.html#readOnly-prop">read-only</a>.</p>
 
473
<p>If the end result would not be acceptable to the current <a href="qlineedit.html#setValidator">validator</a>, nothing happens.</p>
 
474
<p>See also <a href="qlineedit.html#copy">copy</a>() and <a href="qlineedit.html#cut">cut</a>().</p>
 
475
<h3 class="fn"><a name="redo"></a>void QLineEdit::redo ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
476
<p>Redoes the last operation if redo is <a href="qlineedit.html#redoAvailable-prop">available</a>.</p>
 
477
<h3 class="fn"><a name="returnPressed"></a>void QLineEdit::returnPressed ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
478
<p>This signal is emitted when the Return or Enter key is pressed. Note that if there is a <a href="qlineedit.html#validator">validator</a>() or <a href="qlineedit.html#inputMask-prop">inputMask</a>() set on the line edit, the returnPressed() signal will only be emitted if the input follows the <a href="qlineedit.html#inputMask-prop">inputMask</a>() and the <a href="qlineedit.html#validator">validator</a>() returns <tt>Acceptable</tt>.</p>
 
479
<h3 class="fn"><a name="selectAll"></a>void QLineEdit::selectAll ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
480
<p>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>
 
481
<p>See also <a href="qlineedit.html#setSelection">setSelection</a>() and <a href="qlineedit.html#deselect">deselect</a>().</p>
 
482
<h3 class="fn"><a name="selectionChanged"></a>void QLineEdit::selectionChanged ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
483
<p>This signal is emitted whenever the selection changes.</p>
 
484
<p>See also <a href="qlineedit.html#hasSelectedText-prop">hasSelectedText</a>() and <a href="qlineedit.html#selectedText-prop">selectedText</a>().</p>
 
485
<h3 class="fn"><a name="selectionStart"></a>int QLineEdit::selectionStart () const</h3>
 
486
<p>selectionStart() returns the index of the first selected character in the line edit or -1 if no text is selected.</p>
 
487
<p>See also <a href="qlineedit.html#selectedText-prop">selectedText</a>().</p>
 
488
<h3 class="fn"><a name="setSelection"></a>void QLineEdit::setSelection ( int <i>start</i>, int <i>length</i> )</h3>
 
489
<p>Selects text from position <i>start</i> and for <i>length</i> characters. Negative lengths are allowed.</p>
 
490
<p>See also <a href="qlineedit.html#deselect">deselect</a>(), <a href="qlineedit.html#selectAll">selectAll</a>(), and <a href="qlineedit.html#selectedText-prop">selectedText</a>().</p>
 
491
<h3 class="fn"><a name="setValidator"></a>void QLineEdit::setValidator ( const <a href="qvalidator.html">QValidator</a> * <i>v</i> )</h3>
 
492
<p>Sets this line edit to only accept input that the validator, <i>v</i>, will accept. This allows you to place any arbitrary constraints on the text which may be entered.</p>
 
493
<p>If <i>v</i> == 0, setValidator() removes the current input validator. The initial setting is to have no input validator (i.e. any input is accepted up to <a href="qlineedit.html#maxLength-prop">maxLength</a>()).</p>
 
494
<p>See also <a href="qlineedit.html#validator">validator</a>(), <a href="qintvalidator.html">QIntValidator</a>, <a href="qdoublevalidator.html">QDoubleValidator</a>, and <a href="qregexpvalidator.html">QRegExpValidator</a>.</p>
 
495
<h3 class="fn"><a name="sizeHint"></a><a href="qsize.html">QSize</a> QLineEdit::sizeHint () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
496
<p>Returns a recommended size for the widget.</p>
 
497
<p>The width returned, in pixels, is usually enough for about 15 to 20 characters.</p>
 
498
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget</a>.</p>
 
499
<h3 class="fn"><a name="textChanged"></a>void QLineEdit::textChanged ( const <a href="qstring.html">QString</a> &amp; <i>text</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
500
<p>This signal is emitted whenever the text changes. The <i>text</i> argument is the new text.</p>
 
501
<p>Unlike <a href="qlineedit.html#textEdited">textEdited</a>(), this signal is also emitted when programmatically setting the text via <a href="qlineedit.html#text-prop">setText</a>().</p>
 
502
<h3 class="fn"><a name="textEdited"></a>void QLineEdit::textEdited ( const <a href="qstring.html">QString</a> &amp; <i>text</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
503
<p>This signal is emitted whenever the text is edited. The <i>text</i> argument is the next text.</p>
 
504
<p>Unlike <a href="qlineedit.html#textChanged">textChanged</a>(), this signal is <i>not</i> emitted when programmatically setting the text via <a href="qlineedit.html#text-prop">setText</a>().</p>
 
505
<h3 class="fn"><a name="undo"></a>void QLineEdit::undo ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
506
<p>Undoes the last operation if undo is <a href="qlineedit.html#undoAvailable-prop">available</a>. Deselects any current selection, and updates the selection start to the current cursor position.</p>
 
507
<h3 class="fn"><a name="validator"></a>const <a href="qvalidator.html">QValidator</a> * QLineEdit::validator () const</h3>
 
508
<p>Returns a pointer to the current input validator, or 0 if no validator has been set.</p>
 
509
<p>See also <a href="qlineedit.html#setValidator">setValidator</a>().</p>
 
510
<p /><address><hr /><div align="center">
 
511
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
512
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
513
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
514
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
515
</tr></table></div></address></body>
 
516
</html>