Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickcombobox_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKCOMBOBOX_P_H
5#define QQUICKCOMBOBOX_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qloggingcategory.h>
19#include <QtQmlModels/private/qtqmlmodels-config_p.h>
20#include <QtQuickTemplates2/private/qquickcontrol_p.h>
21
22QT_REQUIRE_CONFIG(qml_delegate_model);
23
25
26Q_DECLARE_LOGGING_CATEGORY(lcItemManagement)
27
28class QValidator;
29class QQuickPopup;
32
33class Q_QUICKTEMPLATES2_EXPORT QQuickComboBox : public QQuickControl
34{
36 Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
37 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
38 Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL)
39 Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
40 Q_PROPERTY(int highlightedIndex READ highlightedIndex NOTIFY highlightedIndexChanged FINAL)
41 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
42 Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged FINAL)
43 Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText RESET resetDisplayText NOTIFY displayTextChanged FINAL)
44 Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
45 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
46 Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
47 Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
48 // 2.1 (Qt 5.8)
49 Q_PROPERTY(bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL REVISION(2, 1))
50 // 2.2 (Qt 5.9)
51 Q_PROPERTY(bool down READ isDown WRITE setDown RESET resetDown NOTIFY downChanged FINAL REVISION(2, 2))
52 Q_PROPERTY(bool editable READ isEditable WRITE setEditable NOTIFY editableChanged FINAL REVISION(2, 2))
53 Q_PROPERTY(QString editText READ editText WRITE setEditText RESET resetEditText NOTIFY editTextChanged FINAL REVISION(2, 2))
54#if QT_CONFIG(validator)
55 Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL REVISION(2, 2))
56#endif
57 Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged FINAL REVISION(2, 2))
58 Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged FINAL REVISION(2, 2))
59 Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged FINAL REVISION(2, 2))
60 // 2.5 (Qt 5.12)
61 Q_PROPERTY(qreal implicitIndicatorWidth READ implicitIndicatorWidth NOTIFY implicitIndicatorWidthChanged FINAL REVISION(2, 5))
62 Q_PROPERTY(qreal implicitIndicatorHeight READ implicitIndicatorHeight NOTIFY implicitIndicatorHeightChanged FINAL REVISION(2, 5))
63 Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,indicator,popup")
64 // 2.14 (Qt 5.14)
65 Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY currentValueChanged FINAL REVISION(2, 14))
66 Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole NOTIFY valueRoleChanged FINAL REVISION(2, 14))
67 // 2.15 (Qt 5.15)
68 Q_PROPERTY(bool selectTextByMouse READ selectTextByMouse WRITE setSelectTextByMouse NOTIFY selectTextByMouseChanged FINAL REVISION(2, 15))
69 // 6.0 (Qt 6.0)
70 Q_PROPERTY(ImplicitContentWidthPolicy implicitContentWidthPolicy READ implicitContentWidthPolicy
71 WRITE setImplicitContentWidthPolicy NOTIFY implicitContentWidthPolicyChanged FINAL REVISION(6, 0))
72 QML_NAMED_ELEMENT(ComboBox)
74
75public:
76 explicit QQuickComboBox(QQuickItem *parent = nullptr);
78
79 int count() const;
80
81 QVariant model() const;
82 void setModel(const QVariant &model);
83 QQmlInstanceModel *delegateModel() const;
84
85 bool isPressed() const;
86 void setPressed(bool pressed);
87
88 int highlightedIndex() const;
89
90 int currentIndex() const;
91 void setCurrentIndex(int index);
92
93 QString currentText() const;
94
95 QString displayText() const;
96 void setDisplayText(const QString &text);
97 void resetDisplayText();
98
99 QString textRole() const;
100 void setTextRole(const QString &role);
101
102 QString valueRole() const;
103 void setValueRole(const QString &role);
104
105 QQmlComponent *delegate() const;
106 void setDelegate(QQmlComponent *delegate);
107
108 QQuickItem *indicator() const;
109 void setIndicator(QQuickItem *indicator);
110
111 QQuickPopup *popup() const;
112 void setPopup(QQuickPopup *popup);
113
114 Q_INVOKABLE QString textAt(int index) const;
115 Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const;
116
117 // 2.1 (Qt 5.8)
118 bool isFlat() const;
119 void setFlat(bool flat);
120
121 // 2.2 (Qt 5.9)
122 bool isDown() const;
123 void setDown(bool down);
124 void resetDown();
125
126 bool isEditable() const;
127 void setEditable(bool editable);
128
129 QString editText() const;
130 void setEditText(const QString &text);
131 void resetEditText();
132
133#if QT_CONFIG(validator)
134 QValidator *validator() const;
135 void setValidator(QValidator *validator);
136#endif
137
138 Qt::InputMethodHints inputMethodHints() const;
139 void setInputMethodHints(Qt::InputMethodHints hints);
140
141 bool isInputMethodComposing() const;
142 bool hasAcceptableInput() const;
143
144 // 2.5 (Qt 5.12)
145 qreal implicitIndicatorWidth() const;
146 qreal implicitIndicatorHeight() const;
147
148 // 2.14 (Qt 5.14)
149 QVariant currentValue() const;
151 Q_REVISION(2, 14) Q_INVOKABLE int indexOfValue(const QVariant &value) const;
152
153 // 2.15 (Qt 5.15)
154 bool selectTextByMouse() const;
155 void setSelectTextByMouse(bool canSelect);
156
157 // 6.0 (Qt 6.0)
163 Q_ENUM(ImplicitContentWidthPolicy)
164
165 ImplicitContentWidthPolicy implicitContentWidthPolicy() const;
166 void setImplicitContentWidthPolicy(ImplicitContentWidthPolicy policy);
167
168public Q_SLOTS:
169 void incrementCurrentIndex();
170 void decrementCurrentIndex();
172
174 void activated(int index);
175 void highlighted(int index);
176 void countChanged();
177 void modelChanged();
178 void delegateModelChanged();
179 void pressedChanged();
180 void highlightedIndexChanged();
181 void currentIndexChanged();
182 void currentTextChanged();
183 void displayTextChanged();
184 void textRoleChanged();
185 void delegateChanged();
186 void indicatorChanged();
187 void popupChanged();
188 // 2.1 (Qt 5.8)
189 Q_REVISION(2, 1) void flatChanged();
190 // 2.2 (Qt 5.9)
191 Q_REVISION(2, 2) void accepted();
192 Q_REVISION(2, 2) void downChanged();
193 Q_REVISION(2, 2) void editableChanged();
194 Q_REVISION(2, 2) void editTextChanged();
195#if QT_CONFIG(validator)
196 Q_REVISION(2, 2) void validatorChanged();
197#endif
198 Q_REVISION(2, 2) void inputMethodHintsChanged();
199 Q_REVISION(2, 2) void inputMethodComposingChanged();
200 Q_REVISION(2, 2) void acceptableInputChanged();
201 // 2.5 (Qt 5.12)
202 Q_REVISION(2, 5) void implicitIndicatorWidthChanged();
203 Q_REVISION(2, 5) void implicitIndicatorHeightChanged();
204 // 2.14 (Qt 5.14)
205 Q_REVISION(2, 14) void valueRoleChanged();
206 Q_REVISION(2, 14) void currentValueChanged();
207 // 2.15 (Qt 5.15)
208 Q_REVISION(2, 15) void selectTextByMouseChanged();
209 // 6.0 (Qt 6.0)
210 Q_REVISION(6, 0) void implicitContentWidthPolicyChanged();
211
212protected:
213 bool eventFilter(QObject *object, QEvent *event) override;
214 void focusInEvent(QFocusEvent *event) override;
215 void focusOutEvent(QFocusEvent *event) override;
216#if QT_CONFIG(im)
217 void inputMethodEvent(QInputMethodEvent *event) override;
218#endif
219 void keyPressEvent(QKeyEvent *event) override;
220 void keyReleaseEvent(QKeyEvent *event) override;
221#if QT_CONFIG(wheelevent)
222 void wheelEvent(QWheelEvent *event) override;
223#endif
224 bool event(QEvent *e) override;
225
226 void componentComplete() override;
227 void itemChange(ItemChange change, const ItemChangeData &value) override;
228 void fontChange(const QFont &newFont, const QFont &oldFont) override;
229 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
230 void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
231
232 QFont defaultFont() const override;
233
234#if QT_CONFIG(accessibility)
235 QAccessible::Role accessibleRole() const override;
236 void accessibilityActiveChanged(bool active) override;
237#endif
238
239private:
240 Q_DISABLE_COPY(QQuickComboBox)
241 Q_DECLARE_PRIVATE(QQuickComboBox)
242};
243
245
246#endif // QQUICKCOMBOBOX_P_H
\inmodule QtCore
Definition qcoreevent.h:45
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
\reentrant
Definition qfont.h:22
The QInputMethodEvent class provides parameters for input method events.
Definition qevent.h:625
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtCore
Definition qobject.h:103
The QQmlComponent class encapsulates a QML component definition.
Q_REVISION(2, 2) void selectAll()
Q_REVISION(2, 14) Q_INVOKABLE QVariant valueAt(int index) const
Q_REVISION(2, 2) void inputMethodHintsChanged()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QValidator class provides validation of input text.
Definition qvalidator.h:24
\inmodule QtCore
Definition qvariant.h:65
QString text
button setDown(true)
Combined button and popup list for selecting options.
Definition qcompare.h:63
static jboolean selectAll(JNIEnv *, jobject)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint index
[2]
GLenum GLenum GLsizei count
GLbitfield flags
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static qreal valueAt(const QQuickRangeSlider *slider, qreal position)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
view setModel(model)
[17] //! [18]
QSqlQueryModel * model
[16]
QSizePolicy policy
\inmodule QtQuick
Definition qquickitem.h:159