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

📄 qlineedit.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 3 页
字号:
This signal is emitted when the Return or Enter key is pressed.<p>Example: <a href="popup-example.html#x1576">popup/popup.cpp</a>.<h3 class=fn>void <a name="selectAll"></a>QLineEdit::selectAll ()<tt> [virtual slot]</tt></h3>Selects all the text (i.e. highlights it) and moves the cursor tothe end. This is useful when a default value has been insertedbecause if the user types before clicking on the widget, theselected text will be erased.<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#deselect">deselect</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText"></a>QLineEdit::selectedText () const</h3><p>Returns any text selected by the user or QString::null.See the <a href="qlineedit.html#selectedText-prop">"selectedText"</a> property for details.<h3 class=fn>void <a name="selectionChanged"></a>QLineEdit::selectionChanged ()<tt> [signal]</tt></h3><p> This signal is emitted whenever the selection changes.<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a> and <a href="#selectedText-prop">selectedText</a>.<h3 class=fn>void <a name="setAlignment"></a>QLineEdit::setAlignment ( int&nbsp;flag )<tt> [virtual slot]</tt></h3><p>Sets the alignment of the line edit to <em>flag</em>.See the <a href="qlineedit.html#alignment-prop">"alignment"</a> property for details.<h3 class=fn>void <a name="setCursorPosition"></a>QLineEdit::setCursorPosition ( int )<tt> [virtual slot]</tt></h3><p>Sets the current cursor position for this line edit.See the <a href="qlineedit.html#cursorPosition-prop">"cursorPosition"</a> property for details.<h3 class=fn>void <a name="setDragEnabled"></a>QLineEdit::setDragEnabled ( bool&nbsp;b )<tt> [virtual slot]</tt></h3><p>Sets whether the lineedit starts a drag if the user presses and moves the mouse on some selected text to <em>b</em>.See the <a href="qlineedit.html#dragEnabled-prop">"dragEnabled"</a> property for details.<h3 class=fn>void <a name="setEchoMode"></a>QLineEdit::setEchoMode ( <a href="qlineedit.html#EchoMode-enum">EchoMode</a> )<tt> [virtual slot]</tt></h3><p>Sets the echo mode of the line edit.See the <a href="qlineedit.html#echoMode-prop">"echoMode"</a> property for details.<h3 class=fn>void <a name="setEdited"></a>QLineEdit::setEdited ( bool )</h3><p>Sets 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="setFrame"></a>QLineEdit::setFrame ( bool )<tt> [virtual slot]</tt></h3><p>Sets whether the line edit draws itself with a frame.See the <a href="qlineedit.html#frame-prop">"frame"</a> property for details.<h3 class=fn>void <a name="setMaxLength"></a>QLineEdit::setMaxLength ( int )<tt> [virtual slot]</tt></h3><p>Sets 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>void <a name="setPasswordChar"></a>QLineEdit::setPasswordChar ( <a href="qchar.html">QChar</a>&nbsp;c )</h3>Sets the password character to <em>c</em>.<p> <p>See also <a href="#passwordChar">passwordChar</a>().<h3 class=fn>void <a name="setReadOnly"></a>QLineEdit::setReadOnly ( bool )<tt> [virtual slot]</tt></h3><p>Sets whether the line edit is read only.See the <a href="qlineedit.html#readOnly-prop">"readOnly"</a> property for details.<h3 class=fn>void <a name="setSelection"></a>QLineEdit::setSelection ( int&nbsp;start, int&nbsp;length )<tt> [virtual slot]</tt></h3>  Sets the selected area of this line edit to start at position <em>start</em> and be <em>length</em> characters long.<p> <p>See also <a href="#deselect">deselect</a>(), <a href="#selectAll">selectAll</a>() and <a href="#getSelection">getSelection</a>().<h3 class=fn>void <a name="setText"></a>QLineEdit::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [virtual slot]</tt></h3><p>Sets the text in the line.See the <a href="qlineedit.html#text-prop">"text"</a> property for details.<h3 class=fn>void <a name="setValidator"></a>QLineEdit::setValidator ( const&nbsp;<a href="qvalidator.html">QValidator</a>&nbsp;*&nbsp;v )<tt> [virtual slot]</tt></h3>Sets this line edit to accept input only as accepted by thevalidator, <em>v</em>, allowing arbitrary constraints on the text whichmay be entered.<p> If <em>v</em> == 0, <a href="#setValidator">setValidator</a>() removes the current input validator.The initial setting is to have no input validator (i.e. any inputis accepted up to <a href="#maxLength">maxLength</a>()).<p> <p>See also <a href="#validator">validator</a>() and <a href="qvalidator.html">QValidator</a>.<p>Examples: <a href="lineedits-example.html#x108">lineedits/lineedits.cpp</a> and <a href="wizard-example.html#x7">wizard/wizard.cpp</a>.<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QLineEdit::sizeHint () const<tt> [virtual]</tt></h3>Returns a recommended size for the widget.<p> The width returned, in pixels, is usually enough for about 15 to 20characters.<p>Example: <a href="addressbook-example.html#x532">addressbook/centralwidget.cpp</a>.<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QLineEdit::text () const</h3><p>Returns the text in the line.See the <a href="qlineedit.html#text-prop">"text"</a> property for details.<h3 class=fn>void <a name="textChanged"></a>QLineEdit::textChanged ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt></h3>This signal is emitted whenever the text changes.The argument is the new text.<p>Examples: <a href="wizard-example.html#x9">wizard/wizard.cpp</a> and <a href="xform-example.html#x1430">xform/xform.cpp</a>.<h3 class=fn>void <a name="undo"></a>QLineEdit::undo ()<tt> [virtual slot]</tt></h3> Undoes the last operation <h3 class=fn>bool <a name="validateAndSet"></a>QLineEdit::validateAndSet ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newText, int&nbsp;newPos, int&nbsp;newMarkAnchor, int&nbsp;newMarkDrag )</h3>  Validates and perhaps sets this line edit to contain <em>newText</em>with the cursor at position <em>newPos</em>, with selected text from <em>newMarkAnchor</em> to <em>newMarkDrag</em>.  Returns TRUE if it changes the lineedit; otherwise returns FALSE.<p> Linebreaks in <em>newText</em> are converted to spaces, and the text istruncated to <a href="#maxLength">maxLength</a>() before its validity is tested.<p> Repaints and emits <a href="#textChanged">textChanged</a>() if appropriate.<h3 class=fn>const&nbsp;<a href="qvalidator.html">QValidator</a>&nbsp;* <a name="validator"></a>QLineEdit::validator () const</h3>Returns a pointer to the current input validator, or 0 if novalidator has been set.<p> <p>See also <a href="#setValidator">setValidator</a>().<p>Example: <a href="wizard-example.html#x10">wizard/wizard.cpp</a>.<hr><h2>Property Documentation</h2><h3 class=fn>Alignment <a name="alignment-prop"></a>alignment</h3> <p>This property holds the alignment of the line edit.<p>Possible Values are Qt::AlignAuto, Qt::AlignLeft,Qt::AlignRight and Qt::AlignHCenter.<p> Attempting to set the alignment to an illegal flag combination doesnothing.<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.<p>Set this property's value with <a href="#setAlignment">setAlignment</a>() and get this property's value with <a href="#alignment">alignment</a>().<h3 class=fn>int <a name="cursorPosition-prop"></a>cursorPosition</h3> <p>This property holds the current cursor position for this line edit.<p>Setting the cursor position causes a repaint when appropriate.<p>Set this property's value with <a href="#setCursorPosition">setCursorPosition</a>() and get this property's value with <a href="#cursorPosition">cursorPosition</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="displayText-prop"></a>displayText</h3> <p>This property holds the text that is displayed.<p>If EchoMode is Normal this returns the same as <a href="#text">text</a>(); if EchoModeis Password it returns a string of asterisks the text().length()characters long, e.g. "******"; if EchoMode is NoEcho returns anempty string, "".<p> <p>See also <a href="#echoMode-prop">echoMode</a>, <a href="#text-prop">text</a> and <a href="#EchoMode-enum">EchoMode</a>.<p>Get this property's value with <a href="#displayText">displayText</a>().<h3 class=fn>bool <a name="dragEnabled-prop"></a>dragEnabled</h3> <p>This property holds whether the lineedit starts a drag if the user presses and moves the mouse on some selected text.<p><p>Set this property's value with <a href="#setDragEnabled">setDragEnabled</a>() and get this property's value with <a href="#dragEnabled">dragEnabled</a>().<h3 class=fn><a href="qlineedit.html#EchoMode-enum">EchoMode</a> <a name="echoMode-prop"></a>echoMode</h3> <p>This property holds the echo mode of the line edit.<p>The initial setting is Normal, but QLineEdit also supports NoEchoand Password modes.<p> The widget's display and the ability to copy or drag the text isaffected by this setting.<p> <p>See also <a href="#EchoMode-enum">EchoMode</a> and <a href="#displayText-prop">displayText</a>.<p>Set this property's value with <a href="#setEchoMode">setEchoMode</a>() and get this property's value with <a href="#echoMode">echoMode</a>().<h3 class=fn>bool <a name="edited-prop"></a>edited</h3> <p>This property holds the edited flag of the line edit.<p>The edited flag is never read by QLineEdit; it has a default value ofFALSE and is changed to TRUE whenever the user changes the line edit'scontents.<p> This is useful for things that need to provide a default valuebut cannot find the default at once.  Just start the line edit withoutthe best default; when the default is known, check the <a href="#edited">edited</a>()return value and set the line edit's contents if the user has notstarted editing the line edit.<p> Calling <a href="#setText">setText</a>() resets the edited flag to FALSE.<p>Set this property's value with <a href="#setEdited">setEdited</a>() and get this property's value with <a href="#edited">edited</a>().<h3 class=fn>bool <a name="frame-prop"></a>frame</h3> <p>This property holds whether the line edit draws itself with a frame.<p>If enabled (the default) the line edit draws itself inside atwo-pixel frame, otherwise the line edit draws itself withoutany frame.<p>Set this property's value with <a href="#setFrame">setFrame</a>() and get this property's value with <a href="#frame">frame</a>().<h3 class=fn>bool <a name="hasMarkedText-prop"></a>hasMarkedText</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> <p>This property holds whether part of the text has been selected by the user (e.g. by clicking and dragging).<p>Get this property's value with <a href="#hasMarkedText">hasMarkedText</a>().<p><p>See also <a href="#selectedText-prop">selectedText</a>.<h3 class=fn>bool <a name="hasSelectedText-prop"></a>hasSelectedText</h3><p>This property holds whether there is any text selected.<p>hasSelectedText() returns TRUE if some or all of the text has beenselected by the user (e.g. by clicking and dragging); otherwisereturns FALSE.<p> <p>See also <a href="#selectedText-prop">selectedText</a>.<p>Get this property's value with <a href="#hasSelectedText">hasSelectedText</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="markedText-prop"></a>markedText</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> <p>This property holds the text selected by the user (e.g. by clicking and dragging), or <a href="qstring.html#QString-null">QString::null</a> if no text is selected.<p>Get this property's value with <a href="#markedText">markedText</a>().<p><p>See also <a href="#hasSelectedText-prop">hasSelectedText</a>.<h3 class=fn>int <a name="maxLength-prop"></a>maxLength</h3> <p>This property holds the maximum permitted length of the text in the editor.<p>If the text is too long, it is truncated at the limit.<p> If truncation occurs any selected text will be unselected, thecursor position is set to 0 and the first part of the string isshown.<p>Set this property's value with <a href="#setMaxLength">setMaxLength</a>() and get this property's value with <a href="#maxLength">maxLength</a>().<h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3> <p>This property holds whether the line edit is read only.<p>In read-only mode, the user can still copy the text to theclipboard or drag-and-drop the text, but cannot edit it.<p> QLineEdit does not show a cursor in read-only mode.<p> <p>See also <a href="qwidget.html#enabled-prop">enabled</a>.<p>Set this property's value with <a href="#setReadOnly">setReadOnly</a>() and get this property's value with <a href="#isReadOnly">isReadOnly</a>().<h3 class=fn>bool <a name="redoAvailable-prop"></a>redoAvailable</h3><p>This property holds whether redo is available.<p><p>Get this property's value with <a href="#isRedoAvailable">isRedoAvailable</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText-prop"></a>selectedText</h3><p>This property holds any text selected by the user or <a href="qstring.html#QString-null">QString::null</a>.<p>Get this property's value with <a href="#selectedText">selectedText</a>().<p><p>See also <a href="#hasSelectedText-prop">hasSelectedText</a>.<h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3> <p>This property holds the text in the line.<p>Setting this property clears the selection, moves the cursor to the endof the line and resets the edited property to FALSE.<p> The text is truncated to <a href="#maxLength">maxLength</a>() length.<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().<h3 class=fn>bool <a name="undoAvailable-prop"></a>undoAvailable</h3><p>This property holds whether undo is available.<p><p>Get this property's value with <a href="#isUndoAvailable">isUndoAvailable</a>().<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright &copy; 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

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