diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-04-23 12:45:24 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-04-23 13:32:23 +0000 |
commit | ec0ad4ca9207acbc524a109ffbacb6cbb0fa18a8 (patch) | |
tree | e18f2fc57930315703f8a953281a3d255b0ecdb6 /src | |
parent | e23beb63cc0dbbe69d193e3445f6ca9d4f586ad4 (diff) |
ComboBox: reset when hidden
Close the popup and reset the pressed state. Same as in focusOutEvent().
Task-number: QTBUG-67684
Change-Id: I51143175b0f90f3edd116723481faed6ac6e7988
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 10 | ||||
-rw-r--r-- | src/quicktemplates2/qquickcombobox_p.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index d992c649..d3226baf 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -1666,6 +1666,16 @@ void QQuickComboBox::componentComplete() } } +void QQuickComboBox::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) +{ + Q_D(QQuickComboBox); + QQuickControl::itemChange(change, value); + if (change == ItemVisibleHasChanged && !value.boolValue) { + d->hidePopup(false); + setPressed(false); + } +} + void QQuickComboBox::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) { Q_D(QQuickComboBox); diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h index ee926daf..2faff745 100644 --- a/src/quicktemplates2/qquickcombobox_p.h +++ b/src/quicktemplates2/qquickcombobox_p.h @@ -194,6 +194,7 @@ protected: #endif void componentComplete() override; + void itemChange(ItemChange change, const ItemChangeData &value) override; void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override; void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override; |