45 #include <QtGui/qwidget.h> 46 #include <QtGui/qabstractitemdelegate.h> 47 #include <QtCore/qabstractitemmodel.h> 48 #include <QtCore/qvariant.h> 55 #ifndef QT_NO_COMBOBOX 76 int minimumContentsLength;
79 #ifndef QT_NO_COMPLETER 82 #endif // QT_NO_COMPLETER 92 int maxVisibleItems()
const;
93 void setMaxVisibleItems(
int maxItems);
96 void setMaxCount(
int max);
99 #ifndef QT_NO_COMPLETER 100 bool autoCompletion()
const;
101 void setAutoCompletion(
bool enable);
107 bool duplicatesEnabled()
const;
108 void setDuplicatesEnabled(
bool enable);
111 bool hasFrame()
const;
127 #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) 129 NoInsertion = NoInsert,
131 AtCurrent = InsertAtCurrent,
132 AtBottom = InsertAtBottom,
133 AfterCurrent = InsertAfterCurrent,
134 BeforeCurrent = InsertBeforeCurrent
148 AdjustToMinimumContentsLengthWithIcon
153 int minimumContentsLength()
const;
154 void setMinimumContentsLength(
int characters);
155 QSize iconSize()
const;
156 void setIconSize(
const QSize &size);
158 bool isEditable()
const;
159 void setEditable(
bool editable);
162 #ifndef QT_NO_VALIDATOR 167 #ifndef QT_NO_COMPLETER 181 int modelColumn()
const;
182 void setModelColumn(
int visibleColumn);
184 int currentIndex()
const;
193 inline void addItem(
const QIcon &icon,
const QString &text,
196 { insertItems(count(), texts); }
199 void insertItem(
int index,
const QIcon &icon,
const QString &text,
201 void insertItems(
int index,
const QStringList &texts);
202 void insertSeparator(
int index);
204 void removeItem(
int index);
206 void setItemText(
int index,
const QString &text);
207 void setItemIcon(
int index,
const QIcon &icon);
216 virtual void showPopup();
217 virtual void hidePopup();
223 void clearEditText();
224 void setEditText(
const QString &text);
225 void setCurrentIndex(
int index);
228 void editTextChanged(
const QString &);
229 void activated(
int index);
230 void activated(
const QString &);
231 void highlighted(
int index);
232 void highlighted(
const QString &);
233 void currentIndexChanged(
int index);
234 void currentIndexChanged(
const QString &);
248 #ifndef QT_NO_WHEELEVENT 259 QT3_SUPPORT_CONSTRUCTOR QComboBox(
bool rw,
QWidget *parent,
const char *name = 0);
260 inline QT3_SUPPORT
int currentItem()
const {
return currentIndex(); }
261 inline QT3_SUPPORT
void setCurrentItem(
int index) { setCurrentIndex(index); }
262 inline QT3_SUPPORT
InsertPolicy insertionPolicy()
const {
return insertPolicy(); }
263 inline QT3_SUPPORT
void setInsertionPolicy(
InsertPolicy policy) { setInsertPolicy(policy); }
264 inline QT3_SUPPORT
bool editable()
const {
return isEditable(); }
265 inline QT3_SUPPORT
void popup() { showPopup(); }
266 inline QT3_SUPPORT
void setCurrentText(
const QString& text) {
267 int i = findText(text);
270 else if (isEditable())
273 setItemText(currentIndex(), text);
275 inline QT3_SUPPORT
QString text(
int index)
const {
return itemText(index); }
277 inline QT3_SUPPORT
QPixmap pixmap(
int index)
const 279 inline QT3_SUPPORT
void insertStringList(
const QStringList &list,
int index = -1)
280 { insertItems((index < 0 ? count() : index), list); }
281 inline QT3_SUPPORT
void insertItem(
const QString &text,
int index = -1)
282 { insertItem((index < 0 ? count() : index), text); }
283 inline QT3_SUPPORT
void insertItem(
const QPixmap &pix,
int index = -1)
284 { insertItem((index < 0 ? count() : index),
QIcon(pix),
QString()); }
285 inline QT3_SUPPORT
void insertItem(
const QPixmap &pix,
const QString &text,
int index = -1)
286 { insertItem((index < 0 ? count() : index),
QIcon(pix), text); }
287 inline QT3_SUPPORT
void changeItem(
const QString &text,
int index)
288 { setItemText(index, text); }
289 inline QT3_SUPPORT
void changeItem(
const QPixmap &pix,
int index)
290 { setItemIcon(index,
QIcon(pix)); }
291 inline QT3_SUPPORT
void changeItem(
const QPixmap &pix,
const QString &text,
int index)
292 { setItemIcon(index,
QIcon(pix)); setItemText(index, text); }
293 inline QT3_SUPPORT
void clearValidator() { setValidator(0); }
294 inline QT3_SUPPORT
void clearEdit() { clearEditText(); }
318 #ifdef QT_KEYPAD_NAVIGATION 324 { insertItem(count(), atext, auserData); }
327 { insertItem(count(), aicon, atext, auserData); }
331 { insertItem(aindex,
QIcon(), atext, auserData); }
333 #endif // QT_NO_COMBOBOX 339 #endif // QCOMBOBOX_H The QVariant class acts like a union for the most common Qt data types.
The QAbstractItemDelegate class is used to display and edit data items from a model.
The QKeyEvent class describes a key event.
#define QT_END_NAMESPACE
This macro expands to.
The QWheelEvent class contains parameters that describe a wheel event.
SizeAdjustPolicy
This enum specifies how the size hint of the QComboBox should adjust when new content is added or con...
static void clear(QVariant::Private *d)
The QCompleter class provides completions based on an item model.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define Q_PRIVATE_SLOT(d, signature)
The QString class provides a Unicode character string.
void addItem(const QString &text, const QVariant &userData=QVariant())
Adds an item to the combobox with the given text, and containing the specified userData (stored in th...
InsertPolicy
This enum specifies what the QComboBox should do when a new string is entered by the user...
bool autoCompletion
whether the combobox provides auto-completion for editable items
void addItems(const QStringList &texts)
Adds each of the strings in the given texts to the combobox.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QValidator class provides validation of input text.
void insertItem(int index, const QString &text, const QVariant &userData=QVariant())
Inserts the text and userData (stored in the Qt::UserRole) into the combobox at the given index...
int modelColumn
the column in the model that is visible.
Qt::CaseSensitivity autoCompletionCaseSensitivity
whether string comparisons are case-sensitive or case-insensitive for auto-completion ...
The QHideEvent class provides an event which is sent after a widget is hidden.
The QStringList class provides a list of strings.
int findText(const QString &text, Qt::MatchFlags flags=static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
Returns the index of the item containing the given text; otherwise returns -1.
The QComboBox widget is a combined button and popup list.
The QResizeEvent class contains event parameters for resize events.
static const char * data(const QByteArray &arr)
The QShowEvent class provides an event that is sent when a widget is shown.
The QAbstractItemModel class provides the abstract interface for item model classes.
The QMouseEvent class contains parameters that describe a mouse event.
bool frame
whether the combo box draws itself with a frame
The QAbstractItemView class provides the basic functionality for item view classes.
The QModelIndex class is used to locate data in a data model.
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
The QLineEdit widget is a one-line text editor.
The QPixmap class is an off-screen image representation that can be used as a paint device...
The QSize class defines the size of a two-dimensional object using integer point precision.
#define Q_DECLARE_PRIVATE(Class)
bool duplicatesEnabled
whether the user can enter duplicate items into the combobox
The QPaintEvent class contains event parameters for paint events.
static const KeyPair *const end
The QEvent class is the base class of all event classes.
The QFocusEvent class contains event parameters for widget focus events.
The QIcon class provides scalable icons in different modes and states.