diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-05-11 15:45:31 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-05-12 10:05:01 +0000 |
commit | 3adeceaa1cfe5fae55ca6bd75226c52363a7e7d3 (patch) | |
tree | 32945e6debb61a5a95d40d7fc3e1d8dc6b82ad35 /src | |
parent | 456d26e97ec7745fdbd1afaaaa6c1dc217eca060 (diff) |
ComboBox: fix currentValue not being updated on model changes
Make sure we call updateCurrentValue() where necessary.
Fixes: QTBUG-83554
Pick-to: 5.15
Change-Id: Iad593c2fc094a26429de1eda91bbdb152ffee2c2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index f55aabb6..85f135c7 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -406,13 +406,13 @@ void QQuickComboBoxPrivate::createdItem(int index, QObject *object) } if (index == currentIndex && !q->isEditable()) - updateCurrentText(); + updateCurrentTextAndValue(); } void QQuickComboBoxPrivate::modelUpdated() { if (!extra.isAllocated() || !extra->accepting) - updateCurrentText(); + updateCurrentTextAndValue(); } void QQuickComboBoxPrivate::countChanged() @@ -870,11 +870,11 @@ void QQuickComboBox::setModel(const QVariant& m) if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(d->model)) { QObjectPrivate::disconnect(aim, &QAbstractItemModel::dataChanged, - d, QOverload<>::of(&QQuickComboBoxPrivate::updateCurrentText)); + d, QOverload<>::of(&QQuickComboBoxPrivate::updateCurrentTextAndValue)); } if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(model)) { QObjectPrivate::connect(aim, &QAbstractItemModel::dataChanged, - d, QOverload<>::of(&QQuickComboBoxPrivate::updateCurrentText)); + d, QOverload<>::of(&QQuickComboBoxPrivate::updateCurrentTextAndValue)); } d->model = model; @@ -882,7 +882,7 @@ void QQuickComboBox::setModel(const QVariant& m) emit countChanged(); if (isComponentComplete()) { setCurrentIndex(count() > 0 ? 0 : -1); - d->updateCurrentText(); + d->updateCurrentTextAndValue(); } emit modelChanged(); } @@ -1874,7 +1874,7 @@ bool QQuickComboBox::event(QEvent *e) { Q_D(QQuickComboBox); if (e->type() == QEvent::LanguageChange) - d->updateCurrentText(); + d->updateCurrentTextAndValue(); return QQuickControl::event(e); } |