📄 qcombobox.3qt
字号:
'\" t.TH QComboBox 3qt "5 August 2004" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQComboBox \- Combined button and popup list.br.PP\fC#include <qcombobox.h>\fR.PPInherits QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQComboBox\fR ( QWidget * " "parent" "=0, const char * " "name" "=0 ) ".br.ti -1c.BI "\fBQComboBox\fR ( bool " "rw" ", QWidget * " "parent" "=0, const char * " "name" "=0 ) ".br.ti -1c.BI "\fB~QComboBox\fR () ".br.ti -1c.BI "int \fBcount\fR () const".br.ti -1c.BI "void \fBinsertStringList\fR ( const QStringList &, int " "index" "=-1 ) ".br.ti -1c.BI "void \fBinsertStrList\fR ( const QStrList &, int " "index" "=-1 ) ".br.ti -1c.BI "void \fBinsertStrList\fR ( const QStrList *, int " "index" "=-1 ) ".br.ti -1c.BI "void \fBinsertStrList\fR ( const char **, int " "numStrings" "=-1, int " "index" "=-1 ) ".br.ti -1c.BI "void \fBinsertItem\fR ( const QString & " "text" ", int " "index" "=-1 ) ".br.ti -1c.BI "void \fBinsertItem\fR ( const QPixmap & " "pixmap" ", int " "index" "=-1 ) ".br.ti -1c.BI "void \fBinsertItem\fR ( const QPixmap & " "pixmap" ", const QString & " "text" ", int " "index" "=-1 ) ".br.ti -1c.BI "void \fBremoveItem\fR ( int index ) ".br.ti -1c.BI "void \fBclear\fR () ".br.ti -1c.BI "QString \fBcurrentText\fR () const".br.ti -1c.BI "QString \fBtext\fR ( int index ) const".br.ti -1c.BI "const QPixmap* \fBpixmap\fR ( int index ) const".br.ti -1c.BI "void \fBchangeItem\fR ( const QString & " "text" ", int index ) ".br.ti -1c.BI "void \fBchangeItem\fR ( const QPixmap & " "pixmap" ", int index ) ".br.ti -1c.BI "void \fBchangeItem\fR ( const QPixmap & " "pixmap" ", const QString & " "text" ", int index ) ".br.ti -1c.BI "int \fBcurrentItem\fR () const".br.ti -1c.BI "virtual void \fBsetCurrentItem\fR ( int index ) ".br.ti -1c.BI "bool autoResize () const \fI(obsolete)\fR".br.ti -1c.BI "virtual void setAutoResize ( bool ) \fI(obsolete)\fR".br.ti -1c.BI "virtual void \fBsetBackgroundColor\fR ( const QColor & ) ".br.ti -1c.BI "virtual void \fBsetPalette\fR ( const QPalette & ) ".br.ti -1c.BI "virtual void \fBsetFont\fR ( const QFont & ) ".br.ti -1c.BI "virtual void \fBsetSizeLimit\fR ( int ) ".br.ti -1c.BI "int \fBsizeLimit\fR () const".br.ti -1c.BI "virtual void \fBsetMaxCount\fR ( int ) ".br.ti -1c.BI "int \fBmaxCount\fR () const".br.ti -1c.BI "enum \fBPolicy\fR { NoInsertion, AtTop, AtCurrent, AtBottom, AfterCurrent, BeforeCurrent }".br.ti -1c.BI "virtual void \fBsetInsertionPolicy\fR ( Policy policy ) ".br.ti -1c.BI "Policy \fBinsertionPolicy\fR () const".br.ti -1c.BI "virtual void \fBsetValidator\fR ( const QValidator * ) ".br.ti -1c.BI "const QValidator* \fBvalidator\fR () const".br.ti -1c.BI "virtual void \fBsetListBox\fR ( QListBox * ) ".br.ti -1c.BI "QListBox* \fBlistBox\fR () const".br.ti -1c.BI "QLineEdit* \fBlineEdit\fR () const".br.ti -1c.BI "virtual void \fBsetAutoCompletion\fR ( bool ) ".br.ti -1c.BI "bool \fBautoCompletion\fR () const".br.ti -1c.BI "void \fBsetDuplicatesEnabled\fR ( bool enable ) ".br.ti -1c.BI "bool \fBduplicatesEnabled\fR () const".br.ti -1c.BI "bool \fBeditable\fR () const".br.ti -1c.BI "void \fBsetEditable\fR ( bool ) ".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "void \fBclearValidator\fR () ".br.ti -1c.BI "void \fBclearEdit\fR () ".br.ti -1c.BI "virtual void \fBsetEditText\fR ( const QString & ) ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBactivated\fR ( int index ) ".br.ti -1c.BI "void \fBhighlighted\fR ( int index ) ".br.ti -1c.BI "void \fBactivated\fR ( const QString & ) ".br.ti -1c.BI "void \fBhighlighted\fR ( const QString & ) ".br.ti -1c.BI "void \fBtextChanged\fR ( const QString & ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBpopup\fR () ".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE Optionsbool editable editable setEditableint count countQString currentText currentTextint currentItem currentItem setCurrentItembool autoResize autoResize setAutoResizeint sizeLimit sizeLimit setSizeLimitint maxCount maxCount setMaxCountPolicy insertionPolicy insertionPolicy setInsertionPolicybool autoCompletion autoCompletion setAutoCompletionbool duplicatesEnabled duplicatesEnabled setDuplicatesEnabled.TE.fi.SH DESCRIPTIONThe QComboBox widget is a combined button and popup list..PPA combo box may be defined as a selection widget which displays the current selection, and which can pop up a list of possible selections. Some combo boxes also allow the user to select arbitrary strings, using a line editor..PPSince combo boxes occupy little screen space and always display the current selection, they are very well suited to displaying and selecting modes (such as font family and size): The user can always see what mode he/she is in, and the majority of the screen space is available for real work..PPQComboBox supports three different appearances: Motif 1.x, Motif 2.0 and Windows 95. In Motif 1.x, a combo box was called XmOptionMenu. In Motif 2.0, OSF introduced an improved combo box and named that XmComboBox. QComboBox provides both..PPQComboBox provides two different constructors. The simplest one creates an old-style combo box in Motif style:.PP.nf.br QComboBox * c = new QComboBox( this, "read-only combo" );.fi.PPThe other one creates a new-style combo box in Motif style, and can create both read-only and read-write combo boxes:.PP.nf.br QComboBox * c1 = new QComboBox( FALSE, this, "read-only combo" );.br QComboBox * c2 = new QComboBox( TRUE, this, "read-write combo" );.fi.PPNew-style combo boxes use a list box in both Motif and Windows styles, and both the content size and the on-screen size of the list box can be limited. Old-style combo boxes use a popup in Motif style, and that popup will happily grow larger than the desktop if you put enough data in it..PPThe two constructors create identical-looking combos in Windows style..PPCombo boxes can contain pixmaps as well as texts; the insert() and changeItem() functions are suitably overloaded. For read-write combo boxes, the function clearEdit() is provided, to clear the displayed string without changing the combo box' contents..PPA combo box emits two signals, activated() and highlighted(), when a new item has been activated (selected) or highlighted (set to current). Both signals exist in two versions, one with a \fCchar*\fR argument and one with an \fCint\fR argument. If the user highlights or activates a pixmap, only the \fCint\fR signals are emitted..PPWhen the user enters a new string in a read-write combo, the widget may or may not insert it, and it can insert it in several locations. The default policy is is \fCAtBottom,\fR you can change it using setInsertionPolicy()..PPIt is possible to constrain the input to an editable combo box using QValidator; see setValidator(). By default, all input is accepted..PPIf the combo box is not editable then it has a default focusPolicy() of \fCTabFocus,\fR i.e. it will not grab focus if clicked. This differs from both Windows and Motif. If the combo box is editable then it has a default focusPolicy() of \fCStrongFocus,\fR i.e. it will grab focus if clicked..PP.ce 1.B "[Image Omitted]".PP(Motif 1, read-only).br.ce 1.B "[Image Omitted]".PP(Motif 2, read-write).br.ce 1.B "[Image Omitted]".PP(Motif 2, read-only).br.ce 1.B "[Image Omitted]".PP(Windows style).PPSee also QLineEdit, QListBox, QSpinBox, QRadioButton, QButtonGroup, GUI Design Handbook: Combo Box, and GUI Design Handbook: Drop-Down List Box..PPExamples:.(lqmag/qmag.cpp.)l.SS "Member Type Documentation".SH "QComboBox::Policy"This enum type specifies what QComboBox should do with a new string entered by the user. The following policies are defined: .TP\fCNoInsertion\fR means not to insert the string in the combo..TP\fCAtTop\fR means to insert the string at the top of the combo box..TP\fCAtCurrent\fR means to replace the previously selected item with the typed string..TP\fCAtBottom\fR means to insert the string at the bottom of the combo box..TP\fCAfterCurrent\fR means to to insert the string just after the previously selected item..TP\fCBeforeCurrent\fR means to to insert the string just before the previously selected item..IP.PPactivated() is always emitted, of course..PPIf inserting the new string would cause the combo box to breach its content size limit, the item at the other end of the list is deleted. The definition of "other end" is implementation-dependent..SH MEMBER FUNCTION DOCUMENTATION.SH "QComboBox::QComboBox ( QWidget * parent=0, const char * name=0 )"Constructs a combo box widget with a parent and a name..PPThis constructor creates a popup menu if the program uses Motif look and feel; this is compatible with Motif 1.x..SH "QComboBox::QComboBox ( bool rw, QWidget * parent=0, const char * name=0 )"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -