⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qlineedit.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<h3 class=fn><a name="QLineEdit-2"></a>QLineEdit::QLineEdit ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;contents, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</h3>Constructs a line edit containing the text <em>contents</em>.<p> The cursor position is set to the end of the line and the maximum textlength to 32767 characters.<p> The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.<p> <p>See also <a href="#text-prop">text</a> and <a href="#maxLength-prop">maxLength</a>.<h3 class=fn><a name="~QLineEdit"></a>QLineEdit::~QLineEdit ()</h3>Destroys the line edit.<h3 class=fn>int <a name="alignment"></a>QLineEdit::alignment () const</h3><p>Returns the alignment of the line edit.See the <a href="qlineedit.html#alignment-prop">"alignment"</a> property for details.<h3 class=fn>void <a name="backspace"></a>QLineEdit::backspace ()</h3>Deletes the character to the left of the text cursor and moves thecursor one position to the left. If any text has been selected by the user(e.g. by clicking and dragging), the cursor will be put at the beginningof the selected text and the selected text will be removed.<p> <p>See also <a href="#del">del</a>().<h3 class=fn>int <a name="characterAt"></a>QLineEdit::characterAt ( int&nbsp;xpos, <a href="qchar.html">QChar</a>&nbsp;*&nbsp;chr ) const</h3>Returns the index position of the character which is at <em>xpos</em>(in logical coordinates from the left). If <em>chr</em> is not 0, <tt>*&lt;em&gt;chr&lt;/em&gt;</tt>is populated with the character at this position.<h3 class=fn>void <a name="clear"></a>QLineEdit::clear ()<tt> [virtual slot]</tt></h3>Clears the contents of the editor. This is equivalent to <a href="#setText">setText</a>("").<h3 class=fn>void <a name="clearValidator"></a>QLineEdit::clearValidator ()<tt> [virtual slot]</tt></h3>  This slot is equivalent to <a href="#setValidator">setValidator</a>( 0 ). <h3 class=fn>void <a name="copy"></a>QLineEdit::copy () const<tt> [virtual slot]</tt></h3> Copies the selected text to the clipboard, if there is any, andif <a href="#echoMode">echoMode</a>() is Normal.<p> <p>See also <a href="#cut">cut</a>() and <a href="#paste">paste</a>().<h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a>&nbsp;* <a name="createPopupMenu"></a>QLineEdit::createPopupMenu ()<tt> [virtual protected]</tt></h3> This function is called to create the popup menu which is shownwhen the user clicks on the lineedit with the right mouse button. Ifyou want to create a custom popup menu, reimplement this functionand return the popup menu you create. The popup menu's ownership istransferred to the caller.<h3 class=fn>void <a name="cursorBackward"></a>QLineEdit::cursorBackward ( bool&nbsp;mark, int&nbsp;steps = 1 )</h3>Moves the cursor back <em>steps</em> characters. If <em>mark</em> is TRUE eachcharacter moved over is added to the selection; if <em>mark</em> isFALSE the selection is cleared.<p> <p>See also <a href="#cursorForward">cursorForward</a>().<h3 class=fn>void <a name="cursorForward"></a>QLineEdit::cursorForward ( bool&nbsp;mark, int&nbsp;steps = 1 )</h3>Moves the cursor forward <em>steps</em> characters. If <em>mark</em> is TRUE eachcharacter moved over is added to the selection; if <em>mark</em> isFALSE the selection is cleared.<p> <p>See also <a href="#cursorBackward">cursorBackward</a>().<h3 class=fn>void <a name="cursorLeft"></a>QLineEdit::cursorLeft ( bool&nbsp;mark, int&nbsp;steps = 1 )</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> For compatibilty with older applications only. Use <a href="#cursorBackward">cursorBackward</a>()instead.<p>See also <a href="#cursorBackward">cursorBackward</a>().<h3 class=fn>int <a name="cursorPosition"></a>QLineEdit::cursorPosition () const</h3><p>Returns the current cursor position for this line edit.See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.<h3 class=fn>void <a name="cursorRight"></a>QLineEdit::cursorRight ( bool&nbsp;mark, int&nbsp;steps = 1 )</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> <p> Use <a href="#cursorForward">cursorForward</a>() instead.<p> <p>See also <a href="#cursorForward">cursorForward</a>().<h3 class=fn>void <a name="cursorWordBackward"></a>QLineEdit::cursorWordBackward ( bool&nbsp;mark )</h3>Moves the cursor one word backward.  If <em>mark</em> is TRUE, the wordis also selected.<p>See also <a href="#cursorWordForward">cursorWordForward</a>().<h3 class=fn>void <a name="cursorWordForward"></a>QLineEdit::cursorWordForward ( bool&nbsp;mark )</h3>Moves the cursor one word forward.  If <em>mark</em> is TRUE, the word isalso selected.<p>See also <a href="#cursorWordBackward">cursorWordBackward</a>().<h3 class=fn>void <a name="cut"></a>QLineEdit::cut ()<tt> [virtual slot]</tt></h3>Copies the selected text to the clipboard and deletes it, if there isany, and if <a href="#echoMode">echoMode</a>() is Normal.<p> If the current validator disallows deleting the selected text, <a href="#cut">cut</a>()will copy it but not delete it.<p> <p>See also <a href="#copy">copy</a>() and <a href="#paste">paste</a>().<h3 class=fn>void <a name="del"></a>QLineEdit::del ()</h3>Deletes the character on the right side of the text cursor. If any texthas been selected by the user (e.g. by clicking and dragging), the cursorwill be put at the beginning of the selected text and the selected text willbe removed.<p> <p>See also <a href="#backspace">backspace</a>().<h3 class=fn>void <a name="deselect"></a>QLineEdit::deselect ()<tt> [virtual slot]</tt></h3>De-selects all text (i.e. removes highlighting) and leaves thecursor at the current position.<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#selectAll">selectAll</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="displayText"></a>QLineEdit::displayText () const</h3><p>Returns the text that is displayed.See the <a href="qlineedit.html#displayText-prop">"displayText"</a> property for details.<h3 class=fn>bool <a name="dragEnabled"></a>QLineEdit::dragEnabled () const</h3><p>Returns TRUE if the lineedit starts a drag if the user presses and moves the mouse on some selected text; otherwise returns FALSE.See the <a href="qlineedit.html#dragEnabled-prop">"dragEnabled"</a> property for details.<h3 class=fn><a href="qlineedit.html#EchoMode-enum">EchoMode</a> <a name="echoMode"></a>QLineEdit::echoMode () const</h3><p>Returns the echo mode of the line edit.See the <a href="qlineedit.html#echoMode-prop">"echoMode"</a> property for details.<h3 class=fn>bool <a name="edited"></a>QLineEdit::edited () const</h3><p>Returns the edited flag of the line edit.See the <a href="qlineedit.html#edited-prop">"edited"</a> property for details.<h3 class=fn>void <a name="end"></a>QLineEdit::end ( bool&nbsp;mark )</h3>Moves the text cursor to the end of the line. If <em>mark</em> is TRUE,text is selected towards the last position; otherwise, any selectedtext is unselected if the cursor is moved.<p> <p>See also <a href="#home">home</a>().<h3 class=fn>bool <a name="frame"></a>QLineEdit::frame () const</h3><p>Returns TRUE if the line edit draws itself with a frame; otherwise returns FALSE.See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.<h3 class=fn>bool <a name="getSelection"></a>QLineEdit::getSelection ( int&nbsp;*&nbsp;start, int&nbsp;*&nbsp;end )</h3>This function sets <tt>*&lt;em&gt;start&lt;/em&gt;</tt> to the position in the text where theselection starts and <tt>*&lt;em&gt;end&lt;/em&gt;</tt> to the position where the selectionends. Returns TRUE if <em>start</em> and <em>end</em> are not null and ifthere is some selected text; otherwise returns FALSE.<p> <p>See also <a href="#setSelection">setSelection</a>().<h3 class=fn>bool <a name="hasMarkedText"></a>QLineEdit::hasMarkedText () const</h3><p>Returns TRUE if part of the text has been selected by the user (e.g. by clicking and dragging); otherwise returns FALSE.See the <a href="qlineedit.html#hasMarkedText-prop">"hasMarkedText"</a> property for details.<h3 class=fn>bool <a name="hasSelectedText"></a>QLineEdit::hasSelectedText () const</h3><p>Returns TRUE if there is any text selected; otherwise returns FALSE.See the <a href="qlineedit.html#hasSelectedText-prop">"hasSelectedText"</a> property for details.<h3 class=fn>void <a name="home"></a>QLineEdit::home ( bool&nbsp;mark )</h3>  Moves the text cursor to the beginning of the line. If <em>mark</em> is TRUE,text is selected towards the first position; otherwise, any selected text isunselected if the cursor is moved.<p> <p>See also <a href="#end">end</a>().<h3 class=fn>void <a name="insert"></a>QLineEdit::insert ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newText )<tt> [virtual slot]</tt></h3>  Removes any selected text, inserts <em>newText</em>,and validates the result. If it is valid, it sets it as the new contentsof the line edit.<h3 class=fn>bool <a name="isReadOnly"></a>QLineEdit::isReadOnly () const</h3><p>Returns TRUE if the line edit is read only; otherwise returns FALSE.See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.<h3 class=fn>bool <a name="isRedoAvailable"></a>QLineEdit::isRedoAvailable () const</h3><p>Returns TRUE if redo is available; otherwise returns FALSE.See the <a href="qlineedit.html#redoAvailable-prop">"redoAvailable"</a> property for details.<h3 class=fn>bool <a name="isUndoAvailable"></a>QLineEdit::isUndoAvailable () const</h3><p>Returns TRUE if undo is available; otherwise returns FALSE.See the <a href="qlineedit.html#undoAvailable-prop">"undoAvailable"</a> property for details.<h3 class=fn>void <a name="keyPressEvent"></a>QLineEdit::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt></h3>Converts key press event <em>e</em> into a line edit action.<p> If Return or Enter is pressed and the current text is valid (or can be<a href="qvalidator.html#fixup">made valid</a> by the validator),the signal returnPressed is emitted.<p> The default key bindings are listed in the <a href="#desc">detailed  description.</a><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget</a>.<h3 class=fn><a href="qstring.html">QString</a> <a name="markedText"></a>QLineEdit::markedText () const</h3><p>Returns the text selected by the user (e.g. by clicking and dragging), or QString::null if no text is selected.See the <a href="qlineedit.html#markedText-prop">"markedText"</a> property for details.<h3 class=fn>int <a name="maxLength"></a>QLineEdit::maxLength () const</h3><p>Returns the maximum permitted length of the text in the editor.See the <a href="qlineedit.html#maxLength-prop">"maxLength"</a> property for details.<h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSizeHint"></a>QLineEdit::minimumSizeHint () const<tt> [virtual]</tt></h3>Returns a minimum size for the line edit.<p> The width returned is enough for at least one character.<p>Reimplemented from <a href="qwidget.html#minimumSizeHint">QWidget</a>.<h3 class=fn><a href="qchar.html">QChar</a> <a name="passwordChar"></a>QLineEdit::passwordChar () const</h3>Returns the password character.<p> <p>See also <a href="#setPasswordChar">setPasswordChar</a>().<h3 class=fn>void <a name="paste"></a>QLineEdit::paste ()<tt> [virtual slot]</tt></h3>Inserts the clipboard's text at the cursor position, deleting anyselected text.<p> If the end result is not acceptable for the current validator,nothing happens.<p> <p>See also <a href="#copy">copy</a>() and <a href="#cut">cut</a>().<h3 class=fn>void <a name="redo"></a>QLineEdit::redo ()<tt> [virtual slot]</tt></h3> Redoes the last operation <h3 class=fn>void <a name="repaintArea"></a>QLineEdit::repaintArea ( int&nbsp;from, int&nbsp;to )<tt> [protected]</tt></h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> Repaints all characters from <em>from</em> to <em>to</em>.  If cursorPos isbetween from and to, ensures that cursorPos is visible.<h3 class=fn>void <a name="returnPressed"></a>QLineEdit::returnPressed ()<tt> [signal]</tt></h3>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -