aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickcombobox.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-11-04 10:49:42 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-11-06 10:17:22 +0000
commit430fe83ecb7106118cbebd735637aee9e9253914 (patch)
treec27f1c2a5ae6a2b740467375439d8eac021e06e0 /src/quicktemplates2/qquickcombobox.cpp
parent6470a54ed34523822c50ac846a17a9f76564cf58 (diff)
Re-order all revisioned members and add explanatory comments
We've come to realize that even though it's tempting to group similar properties together, organizing the API so that revisions are grouped together makes future maintenance more pleasant. It's a lot easier to to see what was added and when. Change-Id: I47ba7725260f2c259048848cc2a9b17bce2f01c7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcombobox.cpp')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp294
1 files changed, 148 insertions, 146 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 00785598..d22e09d5 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -759,124 +759,6 @@ QQmlInstanceModel *QQuickComboBox::delegateModel() const
return d->delegateModel;
}
-/*!
- \since QtQuick.Controls 2.2 (Qt 5.9)
- \qmlproperty bool QtQuick.Controls::ComboBox::editable
-
- This property holds whether the combo box is editable.
-
- The default value is \c false.
-
- \sa validator
-*/
-bool QQuickComboBox::isEditable() const
-{
- Q_D(const QQuickComboBox);
- return d->extra.isAllocated() && d->extra->editable;
-}
-
-void QQuickComboBox::setEditable(bool editable)
-{
- Q_D(QQuickComboBox);
- if (editable == isEditable())
- return;
-
- if (d->contentItem) {
- if (editable) {
- d->contentItem->installEventFilter(this);
- if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) {
- QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText);
- QObjectPrivate::connect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput);
- }
-#if QT_CONFIG(cursor)
- d->contentItem->setCursor(Qt::IBeamCursor);
-#endif
- } else {
- d->contentItem->removeEventFilter(this);
- if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) {
- QObjectPrivate::disconnect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText);
- QObjectPrivate::disconnect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput);
- }
-#if QT_CONFIG(cursor)
- d->contentItem->unsetCursor();
-#endif
- }
- }
-
- d->extra.value().editable = editable;
- setAccessibleProperty("editable", editable);
- emit editableChanged();
-}
-
-/*!
- \since QtQuick.Controls 2.1 (Qt 5.8)
- \qmlproperty bool QtQuick.Controls::ComboBox::flat
-
- This property holds whether the combo box button is flat.
-
- A flat combo box button does not draw a background unless it is interacted
- with. In comparison to normal combo boxes, flat combo boxes provide looks
- that make them stand out less from the rest of the UI. For instance, when
- placing a combo box into a tool bar, it may be desirable to make the combo
- box flat so it matches better with the flat looks of tool buttons.
-
- The default value is \c false.
-*/
-bool QQuickComboBox::isFlat() const
-{
- Q_D(const QQuickComboBox);
- return d->flat;
-}
-
-void QQuickComboBox::setFlat(bool flat)
-{
- Q_D(QQuickComboBox);
- if (d->flat == flat)
- return;
-
- d->flat = flat;
- emit flatChanged();
-}
-
-/*!
- \since QtQuick.Controls 2.2 (Qt 5.9)
- \qmlproperty bool QtQuick.Controls::ComboBox::down
-
- This property holds whether the combo box button is visually down.
-
- Unless explicitly set, this property is \c true when either \c pressed
- or \c popup.visible is \c true. To return to the default value, set this
- property to \c undefined.
-
- \sa pressed, popup
-*/
-bool QQuickComboBox::isDown() const
-{
- Q_D(const QQuickComboBox);
- return d->down;
-}
-
-void QQuickComboBox::setDown(bool down)
-{
- Q_D(QQuickComboBox);
- d->hasDown = true;
-
- if (d->down == down)
- return;
-
- d->down = down;
- emit downChanged();
-}
-
-void QQuickComboBox::resetDown()
-{
- Q_D(QQuickComboBox);
- if (!d->hasDown)
- return;
-
- setDown(d->pressed || d->isPopupVisible());
- d->hasDown = false;
-}
/*!
\qmlproperty bool QtQuick.Controls::ComboBox::pressed
@@ -1006,34 +888,6 @@ void QQuickComboBox::resetDisplayText()
d->updateCurrentText();
}
-/*!
- \since QtQuick.Controls 2.2 (Qt 5.9)
- \qmlproperty string QtQuick.Controls::ComboBox::editText
-
- This property holds the text in the text field of an editable combo box.
-
- \sa editable
-*/
-QString QQuickComboBox::editText() const
-{
- Q_D(const QQuickComboBox);
- return d->extra.isAllocated() ? d->extra->editText : QString();
-}
-
-void QQuickComboBox::setEditText(const QString &text)
-{
- Q_D(QQuickComboBox);
- if (text == editText())
- return;
-
- d->extra.value().editText = text;
- emit editTextChanged();
-}
-
-void QQuickComboBox::resetEditText()
-{
- setEditText(QString());
-}
/*!
\qmlproperty string QtQuick.Controls::ComboBox::textRole
@@ -1173,6 +1027,154 @@ void QQuickComboBox::setPopup(QQuickPopup *popup)
}
/*!
+ \since QtQuick.Controls 2.1 (Qt 5.8)
+ \qmlproperty bool QtQuick.Controls::ComboBox::flat
+
+ This property holds whether the combo box button is flat.
+
+ A flat combo box button does not draw a background unless it is interacted
+ with. In comparison to normal combo boxes, flat combo boxes provide looks
+ that make them stand out less from the rest of the UI. For instance, when
+ placing a combo box into a tool bar, it may be desirable to make the combo
+ box flat so it matches better with the flat looks of tool buttons.
+
+ The default value is \c false.
+*/
+bool QQuickComboBox::isFlat() const
+{
+ Q_D(const QQuickComboBox);
+ return d->flat;
+}
+
+void QQuickComboBox::setFlat(bool flat)
+{
+ Q_D(QQuickComboBox);
+ if (d->flat == flat)
+ return;
+
+ d->flat = flat;
+ emit flatChanged();
+}
+
+/*!
+ \since QtQuick.Controls 2.2 (Qt 5.9)
+ \qmlproperty bool QtQuick.Controls::ComboBox::down
+
+ This property holds whether the combo box button is visually down.
+
+ Unless explicitly set, this property is \c true when either \c pressed
+ or \c popup.visible is \c true. To return to the default value, set this
+ property to \c undefined.
+
+ \sa pressed, popup
+*/
+bool QQuickComboBox::isDown() const
+{
+ Q_D(const QQuickComboBox);
+ return d->down;
+}
+
+void QQuickComboBox::setDown(bool down)
+{
+ Q_D(QQuickComboBox);
+ d->hasDown = true;
+
+ if (d->down == down)
+ return;
+
+ d->down = down;
+ emit downChanged();
+}
+
+void QQuickComboBox::resetDown()
+{
+ Q_D(QQuickComboBox);
+ if (!d->hasDown)
+ return;
+
+ setDown(d->pressed || d->isPopupVisible());
+ d->hasDown = false;
+}
+
+/*!
+ \since QtQuick.Controls 2.2 (Qt 5.9)
+ \qmlproperty bool QtQuick.Controls::ComboBox::editable
+
+ This property holds whether the combo box is editable.
+
+ The default value is \c false.
+
+ \sa validator
+*/
+bool QQuickComboBox::isEditable() const
+{
+ Q_D(const QQuickComboBox);
+ return d->extra.isAllocated() && d->extra->editable;
+}
+
+void QQuickComboBox::setEditable(bool editable)
+{
+ Q_D(QQuickComboBox);
+ if (editable == isEditable())
+ return;
+
+ if (d->contentItem) {
+ if (editable) {
+ d->contentItem->installEventFilter(this);
+ if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) {
+ QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText);
+ QObjectPrivate::connect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput);
+ }
+#if QT_CONFIG(cursor)
+ d->contentItem->setCursor(Qt::IBeamCursor);
+#endif
+ } else {
+ d->contentItem->removeEventFilter(this);
+ if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) {
+ QObjectPrivate::disconnect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText);
+ QObjectPrivate::disconnect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput);
+ }
+#if QT_CONFIG(cursor)
+ d->contentItem->unsetCursor();
+#endif
+ }
+ }
+
+ d->extra.value().editable = editable;
+ setAccessibleProperty("editable", editable);
+ emit editableChanged();
+}
+
+/*!
+ \since QtQuick.Controls 2.2 (Qt 5.9)
+ \qmlproperty string QtQuick.Controls::ComboBox::editText
+
+ This property holds the text in the text field of an editable combo box.
+
+ \sa editable
+*/
+QString QQuickComboBox::editText() const
+{
+ Q_D(const QQuickComboBox);
+ return d->extra.isAllocated() ? d->extra->editText : QString();
+}
+
+void QQuickComboBox::setEditText(const QString &text)
+{
+ Q_D(QQuickComboBox);
+ if (text == editText())
+ return;
+
+ d->extra.value().editText = text;
+ emit editTextChanged();
+}
+
+void QQuickComboBox::resetEditText()
+{
+ setEditText(QString());
+}
+
+/*!
\since QtQuick.Controls 2.2 (Qt 5.9)
\qmlproperty Validator QtQuick.Controls::ComboBox::validator