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"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { 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 Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main 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 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 <<a href="qlineedit-h.html">qlineedit.h</a>></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 * parent, const char * name = 0 )</li>
|
---|
42 | <li class=fn><a href="#QLineEdit-2"><b>QLineEdit</b></a> ( const QString & contents, QWidget * parent, const char * name = 0 )</li>
|
---|
43 | <li class=fn><a href="#QLineEdit-3"><b>QLineEdit</b></a> ( const QString & contents, const QString & inputMask, QWidget * parent, const char * 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 QString & newText, int newPos, int newMarkAnchor, int newMarkDrag ) <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 mark, int steps = 1 ) <em>(obsolete)</em></li>
|
---|
59 | <li class=fn>void cursorRight ( bool mark, int steps = 1 ) <em>(obsolete)</em></li>
|
---|
60 | <li class=fn>void <a href="#cursorForward"><b>cursorForward</b></a> ( bool mark, int steps = 1 )</li>
|
---|
61 | <li class=fn>void <a href="#cursorBackward"><b>cursorBackward</b></a> ( bool mark, int steps = 1 )</li>
|
---|
62 | <li class=fn>void <a href="#cursorWordForward"><b>cursorWordForward</b></a> ( bool mark )</li>
|
---|
63 | <li class=fn>void <a href="#cursorWordBackward"><b>cursorWordBackward</b></a> ( bool 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 mark )</li>
|
---|
67 | <li class=fn>void <a href="#end"><b>end</b></a> ( bool 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 <em>(obsolete)</em></li>
|
---|
71 | <li class=fn>void setEdited ( bool ) <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 <em>(obsolete)</em></li>
|
---|
78 | <li class=fn>QString markedText () const <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 QString & inputMask )</li>
|
---|
82 | <li class=fn>bool <a href="#hasAcceptableInput"><b>hasAcceptableInput</b></a> () const</li>
|
---|
83 | <li class=fn>int characterAt ( int xpos, QChar * chr ) const <em>(obsolete)</em></li>
|
---|
84 | <li class=fn>bool getSelection ( int * start, int * end ) <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 & )</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 QString & 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 QValidator * v )</li>
|
---|
101 | <li class=fn>virtual void <a href="#setSelection"><b>setSelection</b></a> ( int start, int 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 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 b )</li>
|
---|
108 | </ul>
|
---|
109 | <h2>Signals</h2>
|
---|
110 | <ul>
|
---|
111 | <li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ( const QString & )</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> - whether the input satisfies the inputMask and the validator <em>(read only)</em></li>
|
---|
119 | <li class=fn>Alignment <a href="#alignment-prop"><b>alignment</b></a> - the alignment of the line edit</li>
|
---|
120 | <li class=fn>int <a href="#cursorPosition-prop"><b>cursorPosition</b></a> - the current cursor position for this line edit</li>
|
---|
121 | <li class=fn>QString <a href="#displayText-prop"><b>displayText</b></a> - the displayed text <em>(read only)</em></li>
|
---|
122 | <li class=fn>bool <a href="#dragEnabled-prop"><b>dragEnabled</b></a> - whether the lineedit starts a drag if the user presses and moves the mouse on some selected text</li>
|
---|
123 | <li class=fn>EchoMode <a href="#echoMode-prop"><b>echoMode</b></a> - the line edit's echo mode</li>
|
---|
124 | <li class=fn>bool edited - whether the line edit has been edited. Use modified instead <em>(obsolete)</em></li>
|
---|
125 | <li class=fn>bool <a href="#frame-prop"><b>frame</b></a> - whether the line edit draws itself with a frame</li>
|
---|
126 | <li class=fn>bool hasMarkedText - whether part of the text has been selected by the user. Use hasSelectedText instead <em>(read only)</em> <em>(obsolete)</em></li>
|
---|
127 | <li class=fn>bool <a href="#hasSelectedText-prop"><b>hasSelectedText</b></a> - whether there is any text selected <em>(read only)</em></li>
|
---|
128 | <li class=fn>QString <a href="#inputMask-prop"><b>inputMask</b></a> - the validation input mask</li>
|
---|
129 | <li class=fn>QString markedText - the text selected by the user. Use selectedText instead <em>(read only)</em> <em>(obsolete)</em></li>
|
---|
130 | <li class=fn>int <a href="#maxLength-prop"><b>maxLength</b></a> - the maximum permitted length of the text</li>
|
---|
131 | <li class=fn>bool <a href="#modified-prop"><b>modified</b></a> - whether the line edit's contents has been modified by the user <em>(read only)</em></li>
|
---|
132 | <li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a> - whether the line edit is read only</li>
|
---|
133 | <li class=fn>bool <a href="#redoAvailable-prop"><b>redoAvailable</b></a> - whether redo is available <em>(read only)</em></li>
|
---|
134 | <li class=fn>QString <a href="#selectedText-prop"><b>selectedText</b></a> - the selected text <em>(read only)</em></li>
|
---|
135 | <li class=fn>QString <a href="#text-prop"><b>text</b></a> - the line edit's text</li>
|
---|
136 | <li class=fn>bool <a href="#undoAvailable-prop"><b>undoAvailable</b></a> - whether undo is available <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 * e )</li>
|
---|
141 | <li class=fn>virtual QPopupMenu * <a href="#createPopupMenu"><b>createPopupMenu</b></a> ()</li>
|
---|
142 | <li class=fn>void repaintArea ( int from, int to ) <em>(obsolete)</em></li>
|
---|
143 | </ul>
|
---|
144 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
145 |
|
---|
146 |
|
---|
147 | The 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
|
---|
151 | plain text with a useful collection of editing functions,
|
---|
152 | including 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
|
---|
154 | a "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
|
---|
156 | can 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
|
---|
159 | editing.
|
---|
160 | <p> You can change the text with <a href="#setText">setText</a>() or <a href="#insert">insert</a>(). The text is
|
---|
161 | retrieved with <a href="#text">text</a>(); the displayed text (which may be different,
|
---|
162 | see <a href="#EchoMode-enum">EchoMode</a>) is retrieved with <a href="#displayText">displayText</a>(). Text can be
|
---|
163 | selected with <a href="#setSelection">setSelection</a>() or <a href="#selectAll">selectAll</a>(), and the selection can
|
---|
164 | be <a href="#cut">cut</a>(), <a href="#copy">copy</a>()ied and <a href="#paste">paste</a>()d. The text can be aligned with
|
---|
165 | <a href="#setAlignment">setAlignment</a>().
|
---|
166 | <p> When the text changes the <a href="#textChanged">textChanged</a>() signal is emitted; when
|
---|
167 | the Return or Enter key is pressed the <a href="#returnPressed">returnPressed</a>() signal is
|
---|
168 | emitted. Note that if there is a validator set on the line edit,
|
---|
169 | the returnPressed() signal will only be emitted if the validator
|
---|
170 | returns <tt>Acceptable</tt>.
|
---|
171 | <p> By default, QLineEdits have a frame as specified by the Windows
|
---|
172 | and <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
|
---|
175 | provides a context menu (usually invoked by a right mouse click)
|
---|
176 | that 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
|
---|
207 | cause 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
|
---|
215 | contents.
|
---|
216 | <ul>
|
---|
217 | <li><tt>QLineEdit::Normal</tt> - Display characters as they are entered. This is the
|
---|
218 | default.
|
---|
219 | <li><tt>QLineEdit::NoEcho</tt> - Do not display anything. This may be appropriate
|
---|
220 | for passwords where even the length of the
|
---|
221 | password should be kept secret.
|
---|
222 | <li><tt>QLineEdit::Password</tt> - Display asterisks instead of the characters
|
---|
223 | actually 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> * parent, const char * name = 0 )
|
---|
228 | </h3>
|
---|
229 | Constructs 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 <a href="qstring.html">QString</a> & contents, <a href="qwidget.html">QWidget</a> * parent, const char * name = 0 )
|
---|
235 | </h3>
|
---|
236 | Constructs 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
|
---|
238 | text 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>
|
---|
240 | constructor.
|
---|
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 <a href="qstring.html">QString</a> & contents, const <a href="qstring.html">QString</a> & inputMask, <a href="qwidget.html">QWidget</a> * parent, const char * name = 0 )
|
---|
244 | </h3>
|
---|
245 | Constructs 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
|
---|
247 | text length is set to the length of the mask (the number of mask
|
---|
248 | characters and separators).
|
---|
249 | <p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a>
|
---|
250 | constructor.
|
---|
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>
|
---|
255 | Destroys 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.
|
---|
259 | See 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>
|
---|
262 | If no text is selected, deletes the character to the left of the
|
---|
263 | text cursor and moves the cursor one position to the left. If any
|
---|
264 | text is selected, the cursor is moved to the beginning of the
|
---|
265 | selected 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 xpos, <a href="qchar.html">QChar</a> * 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>
|
---|
273 | Clears the contents of the line edit.
|
---|
274 |
|
---|
275 | <h3 class=fn>void <a name="clearModified"></a>QLineEdit::clearModified ()
|
---|
276 | </h3>
|
---|
277 | Resets 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>
|
---|
282 | This 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>
|
---|
286 | Copies 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> * <a name="createPopupMenu"></a>QLineEdit::createPopupMenu ()<tt> [virtual protected]</tt>
|
---|
291 | </h3>
|
---|
292 | This function is called to create the popup menu which is shown
|
---|
293 | when the user clicks on the line edit with the right mouse button.
|
---|
294 | If you want to create a custom popup menu, reimplement this
|
---|
295 | function and return the popup menu you create. The popup menu's
|
---|
296 | ownership is transferred to the caller.
|
---|
297 |
|
---|
298 | <h3 class=fn>void <a name="cursorBackward"></a>QLineEdit::cursorBackward ( bool mark, int steps = 1 )
|
---|
299 | </h3>
|
---|
300 | Moves the cursor back <em>steps</em> characters. If <em>mark</em> is TRUE each
|
---|
301 | character moved over is added to the selection; if <em>mark</em> is
|
---|
302 | FALSE 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 mark, int steps = 1 )
|
---|
306 | </h3>
|
---|
307 | Moves the cursor forward <em>steps</em> characters. If <em>mark</em> is TRUE
|
---|
308 | each character moved over is added to the selection; if <em>mark</em> is
|
---|
309 | FALSE 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 mark, int 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>
|
---|
316 | For compatibilty with older applications only. Use <a href="#cursorBackward">cursorBackward</a>()
|
---|
317 | instead.
|
---|
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.
|
---|
322 | See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.
|
---|
323 | <h3 class=fn>void <a name="cursorRight"></a>QLineEdit::cursorRight ( bool mark, int 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 mark )
|
---|
331 | </h3>
|
---|
332 | Moves the cursor one word backward. If <em>mark</em> is TRUE, the word
|
---|
333 | is 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 mark )
|
---|
337 | </h3>
|
---|
338 | Moves the cursor one word forward. If <em>mark</em> is TRUE, the word is
|
---|
339 | also 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>
|
---|
344 | Copies the selected text to the clipboard and deletes it, if there
|
---|
345 | is 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>
|
---|
352 | If no text is selected, deletes the character to the right of the
|
---|
353 | text cursor. If any text is selected, the cursor is moved to the
|
---|
354 | beginning 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>
|
---|
359 | Deselects 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.
|
---|
364 | See 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.
|
---|
367 | See 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.
|
---|
370 | See 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.
|
---|
373 | See the <a href="qlineedit.html#edited-prop">"edited"</a> property for details.
|
---|
374 | <h3 class=fn>void <a name="end"></a>QLineEdit::end ( bool mark )
|
---|
375 | </h3>
|
---|
376 | Moves the text cursor to the end of the line unless it is already
|
---|
377 | there. If <em>mark</em> is TRUE, text is selected towards the last
|
---|
378 | position; otherwise, any selected text is unselected if the cursor
|
---|
379 | is 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.
|
---|
384 | See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.
|
---|
385 | <h3 class=fn>bool <a name="getSelection"></a>QLineEdit::getSelection ( int * start, int * 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.
|
---|
387 | use <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.
|
---|
390 | See 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.
|
---|
393 | See 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.
|
---|
396 | See the <a href="qlineedit.html#hasSelectedText-prop">"hasSelectedText"</a> property for details.
|
---|
397 | <h3 class=fn>void <a name="home"></a>QLineEdit::home ( bool mark )
|
---|
398 | </h3>
|
---|
399 | Moves the text cursor to the beginning of the line unless it is
|
---|
400 | already there. If <em>mark</em> is TRUE, text is selected towards the
|
---|
401 | first position; otherwise, any selected text is unselected if the
|
---|
402 | cursor 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.
|
---|
407 | See the <a href="qlineedit.html#inputMask-prop">"inputMask"</a> property for details.
|
---|
408 | <h3 class=fn>void <a name="insert"></a>QLineEdit::insert ( const <a href="qstring.html">QString</a> & newText )<tt> [virtual slot]</tt>
|
---|
409 | </h3>
|
---|
410 | Deletes any selected text, inserts <em>newText</em>, and validates the
|
---|
411 | result. If it is valid, it sets it as the new contents of the line
|
---|
412 | edit.
|
---|
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.
|
---|
416 | See 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.
|
---|
419 | See 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.
|
---|
422 | See 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.
|
---|
425 | See 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> * e )<tt> [virtual protected]</tt>
|
---|
427 | </h3>
|
---|
428 | Converts 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
|
---|
430 | can be <a href="qvalidator.html#fixup">made valid</a> by the
|
---|
431 | validator), 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.
|
---|
444 | See 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.
|
---|
447 | See 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>
|
---|
450 | Returns 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>
|
---|
456 | Inserts the clipboard's text at the cursor position, deleting any
|
---|
457 | selected 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>
|
---|
464 | Redoes 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 from, int 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>
|
---|
470 | Repaints all characters from <em>from</em> to <em>to</em>. If cursorPos is
|
---|
471 | between 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.
|
---|
477 | Note that if there is a <a href="#validator">validator</a>() or <a href="#inputMask">inputMask</a>() set on the line
|
---|
478 | edit, the <a href="#returnPressed">returnPressed</a>() signal will only be emitted if the input
|
---|
479 | follows 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>
|
---|
484 | Selects all the text (i.e. highlights it) and moves the cursor to
|
---|
485 | the end. This is useful when a default value has been inserted
|
---|
486 | because if the user types before clicking on the widget, the
|
---|
487 | selected 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.
|
---|
492 | See 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
|
---|
502 | line 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 flag )<tt> [virtual slot]</tt>
|
---|
506 | </h3><p>Sets the alignment of the line edit to <em>flag</em>.
|
---|
507 | See 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.
|
---|
510 | See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.
|
---|
511 | <h3 class=fn>void <a name="setDragEnabled"></a>QLineEdit::setDragEnabled ( bool 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>.
|
---|
513 | See 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.
|
---|
516 | See 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.
|
---|
519 | See 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.
|
---|
522 | See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.
|
---|
523 | <h3 class=fn>void <a name="setInputMask"></a>QLineEdit::setInputMask ( const <a href="qstring.html">QString</a> & inputMask )
|
---|
524 | </h3><p>Sets the validation input mask to <em>inputMask</em>.
|
---|
525 | See 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.
|
---|
528 | See 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.
|
---|
531 | See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.
|
---|
532 | <h3 class=fn>void <a name="setSelection"></a>QLineEdit::setSelection ( int start, int length )<tt> [virtual slot]</tt>
|
---|
533 | </h3>
|
---|
534 | Selects 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
|
---|
536 | the 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 <a href="qstring.html">QString</a> & )<tt> [virtual slot]</tt>
|
---|
540 | </h3><p>Sets the line edit's text.
|
---|
541 | See the <a href="qlineedit.html#text-prop">"text"</a> property for details.
|
---|
542 | <h3 class=fn>void <a name="setValidator"></a>QLineEdit::setValidator ( const <a href="qvalidator.html">QValidator</a> * v )<tt> [virtual slot]</tt>
|
---|
543 | </h3>
|
---|
544 | Sets this line edit to only accept input that the validator, <em>v</em>,
|
---|
545 | will accept. This allows you to place any arbitrary constraints on
|
---|
546 | the text which may be entered.
|
---|
547 | <p> If <em>v</em> == 0, <a href="#setValidator">setValidator</a>() removes the current input validator.
|
---|
548 | The initial setting is to have no input validator (i.e. any input
|
---|
549 | is 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>
|
---|
555 | Returns a recommended size for the widget.
|
---|
556 | <p> The width returned, in pixels, is usually enough for about 15 to
|
---|
557 | 20 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.
|
---|
562 | See the <a href="qlineedit.html#text-prop">"text"</a> property for details.
|
---|
563 | <h3 class=fn>void <a name="textChanged"></a>QLineEdit::textChanged ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
---|
564 | </h3>
|
---|
565 |
|
---|
566 | <p> This signal is emitted whenever the text changes. The argument is
|
---|
567 | the 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>
|
---|
572 | Undoes the last operation if undo is <a href="#undoAvailable-prop">available</a>. Deselects any current
|
---|
573 | selection, and updates the selection start to the current cursor
|
---|
574 | position.
|
---|
575 |
|
---|
576 | <h3 class=fn>bool <a name="validateAndSet"></a>QLineEdit::validateAndSet ( const <a href="qstring.html">QString</a> & newText, int newPos, int newMarkAnchor, int 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.
|
---|
578 | Use <a href="#setText">setText</a>(), <a href="#setCursorPosition">setCursorPosition</a>() and <a href="#setSelection">setSelection</a>() instead.
|
---|
579 |
|
---|
580 | <h3 class=fn>const <a href="qvalidator.html">QValidator</a> * <a name="validator"></a>QLineEdit::validator () const
|
---|
581 | </h3>
|
---|
582 | Returns a pointer to the current input validator, or 0 if no
|
---|
583 | validator 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
|
---|
597 | does 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
|
---|
610 | text().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
|
---|
623 | affected 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
|
---|
635 | two-pixel frame, otherwise the line edit draws itself without any
|
---|
636 | frame.
|
---|
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
|
---|
647 | selected 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
|
---|
655 | instead 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
|
---|
657 | an empty string ("") or just calling <a href="#setInputMask">setInputMask</a>() with no
|
---|
658 | arguments.
|
---|
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>></tt> <td valign="top">All following alphabetic characters are uppercased.
|
---|
674 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><</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>\</tt> <td valign="top">Use <tt>\</tt> to escape the special
|
---|
677 | characters listed above to use them as
|
---|
678 | separators.
|
---|
679 | </table></center>
|
---|
680 | <p> The mask consists of a string of mask characters and separators,
|
---|
681 | optionally followed by a semi-colon and the character used for
|
---|
682 | blanks: the blank characters are always removed from the text
|
---|
683 | after 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>>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#</tt> <td valign="top">License number;
|
---|
690 | blanks are <tt>-</tt> and all (alphabetic) characters are converted to
|
---|
691 | uppercase.
|
---|
692 | </table></center>
|
---|
693 | <p> To get range control (e.g. for an IP address) use masks together
|
---|
694 | with <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
|
---|
707 | cursor position is set to 0 and the first part of the string is
|
---|
708 | shown.
|
---|
709 | <p> If the line edit has an input mask, the mask defines the maximum
|
---|
710 | string 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
|
---|
717 | of FALSE and is changed to TRUE whenever the user changes the line
|
---|
718 | edit's contents.
|
---|
719 | <p> This is useful for things that need to provide a default value but
|
---|
720 | do not start out knowing what the default should be (perhaps it
|
---|
721 | depends on other fields on the form). Start the line edit without
|
---|
722 | the best default, and when the default is known, if modified()
|
---|
723 | returns FALSE (the user hasn't entered any text), insert the
|
---|
724 | default value.
|
---|
725 | <p> Calling <a href="#clearModified">clearModified</a>() or <a href="#setText">setText</a>() resets the modified flag to
|
---|
726 | FALSE.
|
---|
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
|
---|
732 | clipboard or drag-and-drop the text (if <a href="#echoMode">echoMode</a>() is <a href="#EchoMode-enum">Normal</a>),
|
---|
733 | but 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
|
---|
752 | undo/redo history, moves the cursor to the end of the line and
|
---|
753 | resets the <a href="#modified-prop">modified</a> property to FALSE. The text is not
|
---|
754 | validated 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>
|
---|
765 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
766 | Copyright © 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 © 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>
|
---|