📄 qcombobox.3qt
字号:
.TH QComboBox 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech 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.SH SYNOPSIS.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 \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 "int \fBcurrentItem\fR () const".br.ti -1c.BI "virtual void \fBsetCurrentItem\fR ( int index )".br.ti -1c.BI "bool \fBautoResize\fR () const".br.ti -1c.BI "virtual void \fBsetAutoResize\fR ( bool )".br.ti -1c.BI "virtual QSize \fBsizeHint\fR () const".br.ti -1c.BI "virtual QSizePolicy \fBsizePolicy\fR () const".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 \fBsetEnabled\fR ( bool )".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 "virtual void \fBsetAutoCompletion\fR ( bool )".br.ti -1c.BI "bool \fBautoCompletion\fR () const".br.ti -1c.BI "virtual bool \fBeventFilter\fR ( QObject * " "object" ", QEvent * event )".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 "virtual void \fBpaintEvent\fR ( QPaintEvent * )".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * )".br.ti -1c.BI "virtual void \fBmousePressEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmouseMoveEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmouseReleaseEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmouseDoubleClickEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * e )".br.ti -1c.BI "virtual void \fBfocusInEvent\fR ( QFocusEvent * e )".br.ti -1c.BI "virtual void \fBstyleChange\fR ( QStyle & )".br.ti -1c.BI "void \fBpopup\fR ()".br.ti -1c.BI "virtual void \fBupdateMask\fR ()".br.in -1c.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..PPRead-only combo boxes can contain pixmaps as well as texts; the insert() and changeItem() functions are suitably overloaded. If you try to insert a pixmap in a read-write combo box, QComboBox simply ignores you. 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..PPRead-write combo boxes offer four policies for dealing with typed input: .TP\fCNoInsertion\fR means to simply emit the activated() signal, .TP\fCAtBottom\fR means to insert the string at the bottom of the combo box and emit activated(), .TP\fCAtTop\fR means to insert the string at the top of the combo box and emit activated(), and finally .TP\fCAtCurrent\fR means to replace the previously selected item with the typed string, and emit activated(). If inserting the typed string would cause the combo box to breach its content size limit, the item at the other end of the list is deleted. The default insertion policy 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..PPA combo box has a default focusPolicy() of \fCTabFocus,\fR i.e. it will not grab focus if clicked. This differs from both Windows and Motif..PP<img src="qcombo1-m.png">(Motif 1, read-only).br<img src="qcombo2-m.png">(Motif 2, read-write).br<img src="qcombo3-m.png">(Motif 2, read-only).br<img src="qcombo1-w.png">(Windows style).PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -