qcombobox.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 561 行 · 第 1/3 页
HTML
561 行
<p> <p>See also <a href="#setListBox">setListBox</a>().<p>Example: <a href="listboxcombo-example.html#x1127">listboxcombo/listboxcombo.cpp</a>.<h3 class=fn>int <a name="maxCount"></a>QComboBox::maxCount () const</h3><p>Returns the maximum number of items allowed in the combobox.See the <a href="qcombobox.html#maxCount-prop">"maxCount"</a> property for details.<h3 class=fn>const <a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QComboBox::pixmap ( int index ) const</h3>Returns the pixmap item at position <em>index</em>, or 0 if the item is nota pixmap.<h3 class=fn>void <a name="popup"></a>QComboBox::popup ()<tt> [virtual]</tt></h3>Pops up the combobox popup list.<p> If the list is empty, no items appear.<h3 class=fn>void <a name="removeItem"></a>QComboBox::removeItem ( int index )</h3>Removes the item at position <em>index</em>.<h3 class=fn>void <a name="setAutoCompletion"></a>QComboBox::setAutoCompletion ( bool )<tt> [virtual]</tt></h3><p>Sets whether auto-completion is enabled.See the <a href="qcombobox.html#autoCompletion-prop">"autoCompletion"</a> property for details.<h3 class=fn>void <a name="setAutoResize"></a>QComboBox::setAutoResize ( bool )<tt> [virtual]</tt></h3><p>Sets whether auto resize is enabled.See the <a href="qcombobox.html#autoResize-prop">"autoResize"</a> property for details.<h3 class=fn>void <a name="setCurrentItem"></a>QComboBox::setCurrentItem ( int index )<tt> [virtual]</tt></h3><p>Sets the index of the current item in the combobox to <em>index</em>.See the <a href="qcombobox.html#currentItem-prop">"currentItem"</a> property for details.<h3 class=fn>void <a name="setCurrentText"></a>QComboBox::setCurrentText ( const <a href="qstring.html">QString</a> & )<tt> [virtual]</tt></h3><p>Sets the text of the combobox's current item.See the <a href="qcombobox.html#currentText-prop">"currentText"</a> property for details.<h3 class=fn>void <a name="setDuplicatesEnabled"></a>QComboBox::setDuplicatesEnabled ( bool enable )</h3><p>Sets whether duplicates are allowed to <em>enable</em>.See the <a href="qcombobox.html#duplicatesEnabled-prop">"duplicatesEnabled"</a> property for details.<h3 class=fn>void <a name="setEditText"></a>QComboBox::setEditText ( const <a href="qstring.html">QString</a> & newText )<tt> [virtual slot]</tt></h3> Sets the text in the line edit to <em>newText</em> withoutchanging the combobox's contents. Does nothing if the combobox isn'teditable.<p> This is useful e.g. for providing a good starting point for theuser's editing and entering the change in the combobox only when theuser presses Enter.<p> <p>See also <a href="#clearEdit">clearEdit</a>() and <a href="#insertItem">insertItem</a>().<p>Example: <a href="ftpclient-example.html#x654">network/ftpclient/ftpmainwindow.cpp</a>.<h3 class=fn>void <a name="setEditable"></a>QComboBox::setEditable ( bool )</h3><p>Sets whether the combobox is editable.See the <a href="qcombobox.html#editable-prop">"editable"</a> property for details.<h3 class=fn>void <a name="setFont"></a>QComboBox::setFont ( const <a href="qfont.html">QFont</a> & font )<tt> [virtual]</tt></h3>Reimplements <a href="qwidget.html#setFont">QWidget::setFont</a>().<p> Sets the font for both the combobox button and thecombobox popup list to <em>font</em>.<p>Reimplemented from <a href="qwidget.html#setFont">QWidget</a>.<h3 class=fn>void <a name="setInsertionPolicy"></a>QComboBox::setInsertionPolicy ( <a href="qcombobox.html#Policy-enum">Policy</a> policy )<tt> [virtual]</tt></h3><p>Sets the position of the items inserted by the user to <em>policy</em>.See the <a href="qcombobox.html#insertionPolicy-prop">"insertionPolicy"</a> property for details.<h3 class=fn>void <a name="setLineEdit"></a>QComboBox::setLineEdit ( <a href="qlineedit.html">QLineEdit</a> * edit )<tt> [virtual]</tt></h3> Sets the lineedit to use <em>edit</em> instead of the current lineedit.<h3 class=fn>void <a name="setListBox"></a>QComboBox::setListBox ( <a href="qlistbox.html">QListBox</a> * newListBox )<tt> [virtual]</tt></h3> Sets the combobox to use <em>newListBox</em> instead of the currentlist box or popup. As a side effect, it clears the combobox of itscurrent contents.<p> <b>Warning:</b> QComboBox assumes that newListBox->text(n) returnsnon-null for 0 <= n < newListbox->count(). This assumption isnecessary because of the line edit in QComboBox.<h3 class=fn>void <a name="setMaxCount"></a>QComboBox::setMaxCount ( int )<tt> [virtual]</tt></h3><p>Sets the maximum number of items allowed in the combobox.See the <a href="qcombobox.html#maxCount-prop">"maxCount"</a> property for details.<h3 class=fn>void <a name="setPalette"></a>QComboBox::setPalette ( const <a href="qpalette.html">QPalette</a> & palette )<tt> [virtual]</tt></h3>Reimplements <a href="qwidget.html#setPalette">QWidget::setPalette</a>().<p> Sets the palette for both the combobox button and thecombobox popup list to <em>palette</em>.<p>Reimplemented from <a href="qwidget.html#setPalette">QWidget</a>.<h3 class=fn>void <a name="setSizeLimit"></a>QComboBox::setSizeLimit ( int )<tt> [virtual]</tt></h3><p>Sets the maximum on-screen size of the combobox.See the <a href="qcombobox.html#sizeLimit-prop">"sizeLimit"</a> property for details.<h3 class=fn>void <a name="setValidator"></a>QComboBox::setValidator ( const <a href="qvalidator.html">QValidator</a> * v )<tt> [virtual]</tt></h3>Applies the validator <em>v</em> to the combobox so that only text whichis valid according to <em>v</em> is accepted.<p> This function does nothing if the combo is not editable.<p> <p>See also <a href="#validator">validator</a>(), <a href="#clearValidator">clearValidator</a>() and <a href="qvalidator.html">QValidator</a>.<h3 class=fn>int <a name="sizeLimit"></a>QComboBox::sizeLimit () const</h3><p>Returns the maximum on-screen size of the combobox.See the <a href="qcombobox.html#sizeLimit-prop">"sizeLimit"</a> property for details.<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QComboBox::text ( int index ) const</h3>Returns the text item at position <em>index</em>, or<a href="qstring.html#operator!">null string</a>if the item is not a string.<p>See also <a href="#currentText-prop">currentText</a>.<p>Examples: <a href="fileiconview-example.html#x878">fileiconview/mainwindow.cpp</a> and <a href="helpviewer-example.html#x986">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="textChanged"></a>QComboBox::textChanged ( const <a href="qstring.html">QString</a> & string )<tt> [signal]</tt></h3> <p> This signal is used for editable comboboxes. It is emitted wheneverthe contents of the text entry field changes. <em>string</em> contains thenew text.<h3 class=fn>const <a href="qvalidator.html">QValidator</a> * <a name="validator"></a>QComboBox::validator () const</h3> Returns the validator which constrains editing for this combobox ifthere is one, otherwise returns 0.<p> <p>See also <a href="#setValidator">setValidator</a>(), <a href="#clearValidator">clearValidator</a>() and <a href="qvalidator.html">QValidator</a>.<hr><h2>Property Documentation</h2><h3 class=fn>bool <a name="autoCompletion-prop"></a>autoCompletion</h3> <p>This property holds whether auto-completion is enabled.<p>This property can only be set for editable comboboxes, for non-editablecomboboxes it has no effect. It is FALSE by default.<p>Set this property's value with <a href="#setAutoCompletion">setAutoCompletion</a>() and get this property's value with <a href="#autoCompletion">autoCompletion</a>().<h3 class=fn>bool <a name="autoMask-prop"></a>autoMask</h3> <p>This property holds whether the combobox is automatically masked.<p><p><p>See also <a href="qwidget.html#autoMask-prop">QWidget::autoMask</a>.<h3 class=fn>bool <a name="autoResize-prop"></a>autoResize</h3> <p>This property holds whether auto resize is enabled.<p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> If this property is set to TRUE then the combobox will resize itselfwhenever its contents change. The default is FALSE.<p>Set this property's value with <a href="#setAutoResize">setAutoResize</a>() and get this property's value with <a href="#autoResize">autoResize</a>().<h3 class=fn>int <a name="count-prop"></a>count</h3> <p>This property holds the number of items in the combobox.<p><p>Get this property's value with <a href="#count">count</a>().<h3 class=fn>int <a name="currentItem-prop"></a>currentItem</h3> <p>This property holds the index of the current item in the combobox.<p><p>Set this property's value with <a href="#setCurrentItem">setCurrentItem</a>() and get this property's value with <a href="#currentItem">currentItem</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="currentText-prop"></a>currentText</h3> <p>This property holds the text of the combobox's current item.<p><p>Set this property's value with <a href="#setCurrentText">setCurrentText</a>() and get this property's value with <a href="#currentText">currentText</a>().<h3 class=fn>bool <a name="duplicatesEnabled-prop"></a>duplicatesEnabled</h3> <p>This property holds whether duplicates are allowed.<p>If the combobox is editable and the user enters some text in thelineedit of the combobox and presses Enter (and the<a href="#insertionPolicy">insertionPolicy</a>() is different from NoInsertion), then what happensis as follows:<ul><li> If the text is not already in the list, the text is inserted.<li> If the text is in the list and this property is TRUE (thedefault), the text is inserted.<li> If the text is in the list and this property is FALSE, the textis <em>not</em> inserted; instead the item which has matching text becomesthe current item.</ul><p> This property only affects user-interaction. You can use<a href="#insertItem">insertItem</a>() to insert duplicates if you wish regardless of thissetting.<p> <p>Set this property's value with <a href="#setDuplicatesEnabled">setDuplicatesEnabled</a>() and get this property's value with <a href="#duplicatesEnabled">duplicatesEnabled</a>().<h3 class=fn>bool <a name="editable-prop"></a>editable</h3> <p>This property holds whether the combobox is editable.<p>This property's default is FALSE. Note that the combobox will becleared if this property is set to TRUE for a 1.x Motif stylecombobox. To avoid this, use <a href="#setEditable">setEditable</a>() before inserting anyitems. Also note that the 1.x version of Motif didn't have anyeditable comboboxes, so the combobox will change it's appearanceto a 2.0 style Motif combobox is it is set to be editable.<p>Set this property's value with <a href="#setEditable">setEditable</a>() and get this property's value with <a href="#editable">editable</a>().<h3 class=fn><a href="qcombobox.html#Policy-enum">Policy</a> <a name="insertionPolicy-prop"></a>insertionPolicy</h3> <p>This property holds the position of the items inserted by the user.<p>The default insertion policy is <a href="#Policy-enum">AtBottom</a>.<p>Set this property's value with <a href="#setInsertionPolicy">setInsertionPolicy</a>() and get this property's value with <a href="#insertionPolicy">insertionPolicy</a>().<h3 class=fn>int <a name="maxCount-prop"></a>maxCount</h3> <p>This property holds the maximum number of items allowed in the combobox.<p><p>Set this property's value with <a href="#setMaxCount">setMaxCount</a>() and get this property's value with <a href="#maxCount">maxCount</a>().<h3 class=fn>int <a name="sizeLimit-prop"></a>sizeLimit</h3> <p>This property holds the maximum on-screen size of the combobox.<p>This is disregarded in Motif 1.x style. The default limit is tenlines. If the number of items in the combobox is or grows larger thanlines, a scrollbar is added.<p>Set this property's value with <a href="#setSizeLimit">setSizeLimit</a>() and get this property's value with <a href="#sizeLimit">sizeLimit</a>().<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 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 © 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 + =
减小字号Ctrl + -
显示快捷键?