39 Q_PROPERTY(
int count READ count NOTIFY countChanged FINAL)
40 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
41 Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL)
42 Q_PROPERTY(
bool pressed READ isPressed NOTIFY pressedChanged FINAL)
43 Q_PROPERTY(
int highlightedIndex READ highlightedIndex NOTIFY highlightedIndexChanged FINAL)
44 Q_PROPERTY(
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
45 Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged FINAL)
46 Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText RESET resetDisplayText NOTIFY displayTextChanged FINAL)
47 Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
48 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
49 Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
50 Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
52 Q_PROPERTY(
bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL REVISION(2, 1))
54 Q_PROPERTY(
bool down READ isDown WRITE setDown RESET resetDown NOTIFY downChanged FINAL REVISION(2, 2))
55 Q_PROPERTY(
bool editable READ isEditable WRITE setEditable NOTIFY editableChanged FINAL REVISION(2, 2))
56 Q_PROPERTY(QString editText READ editText WRITE setEditText RESET resetEditText NOTIFY editTextChanged FINAL REVISION(2, 2))
57#if QT_CONFIG(validator)
58 Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL REVISION(2, 2))
60 Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged FINAL REVISION(2, 2))
61 Q_PROPERTY(
bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged FINAL REVISION(2, 2))
62 Q_PROPERTY(
bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged FINAL REVISION(2, 2))
64 Q_PROPERTY(qreal implicitIndicatorWidth READ implicitIndicatorWidth NOTIFY implicitIndicatorWidthChanged FINAL REVISION(2, 5))
65 Q_PROPERTY(qreal implicitIndicatorHeight READ implicitIndicatorHeight NOTIFY implicitIndicatorHeightChanged FINAL REVISION(2, 5))
66 Q_CLASSINFO(
"DeferredPropertyNames",
"background,contentItem,indicator,popup")
68 Q_PROPERTY(QVariant currentValue READ currentValue WRITE setCurrentValue NOTIFY currentValueChanged FINAL REVISION(2, 14))
69 Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole NOTIFY valueRoleChanged FINAL REVISION(2, 14))
71 Q_PROPERTY(
bool selectTextByMouse READ selectTextByMouse WRITE setSelectTextByMouse NOTIFY selectTextByMouseChanged FINAL REVISION(2, 15))
73 Q_PROPERTY(ImplicitContentWidthPolicy implicitContentWidthPolicy READ implicitContentWidthPolicy
74 WRITE setImplicitContentWidthPolicy NOTIFY implicitContentWidthPolicyChanged FINAL REVISION(6, 0))
76 Q_PROPERTY(
bool highlightOnHover READ highlightOnHover WRITE setHighlightOnHover NOTIFY highlightOnHoverChanged REVISION(6, 12))
78 Q_PROPERTY(QQuickText::TextFormat textFormat READ textFormat WRITE setTextFormat RESET resetTextFormat NOTIFY textFormatChanged REVISION(6, 13))
79 QML_NAMED_ELEMENT(ComboBox)
80 QML_ADDED_IN_VERSION(2, 0)
83 explicit QQuickComboBox(QQuickItem *parent =
nullptr);
88 QVariant model()
const;
89 void setModel(
const QVariant &model);
90 QQmlInstanceModel *delegateModel()
const;
92 bool isPressed()
const;
93 void setPressed(
bool pressed);
95 int highlightedIndex()
const;
97 int currentIndex()
const;
98 void setCurrentIndex(
int index);
100 QString currentText()
const;
102 QString displayText()
const;
103 void setDisplayText(
const QString &text);
104 void resetDisplayText();
106 QString textRole()
const;
107 void setTextRole(
const QString &role);
109 QString valueRole()
const;
110 void setValueRole(
const QString &role);
112 QQuickText::TextFormat textFormat()
const;
113 void setTextFormat(QQuickText::TextFormat textFormat);
114 void resetTextFormat();
116 QQmlComponent *delegate()
const;
117 void setDelegate(QQmlComponent *delegate);
119 QQuickItem *indicator()
const;
120 void setIndicator(QQuickItem *indicator);
122 QQuickPopup *popup()
const;
123 void setPopup(QQuickPopup *popup);
125 Q_INVOKABLE QString textAt(
int index)
const;
126 Q_INVOKABLE
int find(
const QString &text, Qt::MatchFlags flags = Qt::MatchExactly)
const;
130 void setFlat(
bool flat);
134 void setDown(
bool down);
137 bool isEditable()
const;
138 void setEditable(
bool editable);
140 QString editText()
const;
141 void setEditText(
const QString &text);
142 void resetEditText();
144#if QT_CONFIG(validator)
145 QValidator *validator()
const;
146 void setValidator(QValidator *validator);
149 Qt::InputMethodHints inputMethodHints()
const;
150 void setInputMethodHints(Qt::InputMethodHints hints);
152 bool isInputMethodComposing()
const;
153 bool hasAcceptableInput()
const;
156 qreal implicitIndicatorWidth()
const;
157 qreal implicitIndicatorHeight()
const;
160 QVariant currentValue()
const;
161 Q_REVISION(6, 10)
void setCurrentValue(
const QVariant &value);
162 Q_REVISION(2, 14) Q_INVOKABLE QVariant valueAt(
int index)
const;
163 Q_REVISION(2, 14) Q_INVOKABLE
int indexOfValue(
const QVariant &value)
const;
166 bool selectTextByMouse()
const;
167 void setSelectTextByMouse(
bool canSelect);
170 enum ImplicitContentWidthPolicy {
171 ContentItemImplicitWidth,
173 WidestTextWhenCompleted
175 Q_ENUM(ImplicitContentWidthPolicy)
177 ImplicitContentWidthPolicy implicitContentWidthPolicy()
const;
178 void setImplicitContentWidthPolicy(ImplicitContentWidthPolicy policy);
181 bool highlightOnHover()
const;
182 void setHighlightOnHover(
bool value);
185 void incrementCurrentIndex();
186 void decrementCurrentIndex();
187 Q_REVISION(2, 2)
void selectAll();
190 void activated(
int index);
191 void highlighted(
int index);
194 void delegateModelChanged();
195 void pressedChanged();
196 void highlightedIndexChanged();
197 void currentIndexChanged();
198 void currentTextChanged();
199 void displayTextChanged();
200 void textRoleChanged();
201 void delegateChanged();
202 void indicatorChanged();
205 Q_REVISION(2, 1)
void flatChanged();
207 Q_REVISION(2, 2)
void accepted();
208 Q_REVISION(2, 2)
void downChanged();
209 Q_REVISION(2, 2)
void editableChanged();
210 Q_REVISION(2, 2)
void editTextChanged();
211#if QT_CONFIG(validator)
212 Q_REVISION(2, 2)
void validatorChanged();
214 Q_REVISION(2, 2)
void inputMethodHintsChanged();
215 Q_REVISION(2, 2)
void inputMethodComposingChanged();
216 Q_REVISION(2, 2)
void acceptableInputChanged();
218 Q_REVISION(2, 5)
void implicitIndicatorWidthChanged();
219 Q_REVISION(2, 5)
void implicitIndicatorHeightChanged();
221 Q_REVISION(2, 14)
void valueRoleChanged();
222 Q_REVISION(2, 14)
void currentValueChanged();
224 Q_REVISION(2, 15)
void selectTextByMouseChanged();
226 Q_REVISION(6, 0)
void implicitContentWidthPolicyChanged();
228 Q_REVISION(6, 12)
void highlightOnHoverChanged();
230 Q_REVISION(6, 13)
void textFormatChanged();
233 bool eventFilter(QObject *object, QEvent *event) override;
234 void focusInEvent(QFocusEvent *event) override;
235 void focusOutEvent(QFocusEvent *event) override;
237 void inputMethodEvent(QInputMethodEvent *event) override;
239 void keyPressEvent(QKeyEvent *event) override;
240 void keyReleaseEvent(QKeyEvent *event) override;
241#if QT_CONFIG(wheelevent)
242 void wheelEvent(QWheelEvent *event) override;
244 bool event(QEvent *e) override;
246 void componentComplete() override;
247 void itemChange(ItemChange change,
const ItemChangeData &value) override;
248 void fontChange(
const QFont &newFont,
const QFont &oldFont) override;
249 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
250 void localeChange(
const QLocale &newLocale,
const QLocale &oldLocale) override;
252 QFont defaultFont()
const override;
254#if QT_CONFIG(accessibility)
255 QAccessible::Role accessibleRole()
const override;
256 void accessibilityActiveChanged(
bool active) override;
260 Q_DISABLE_COPY(QQuickComboBox)
261 Q_DECLARE_PRIVATE(QQuickComboBox)