summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2014-10-21 10:01:58 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2014-10-24 08:51:18 +0200
commitc4430ed02301c456dd591c88049ee22bc7dd9725 (patch)
tree2f82ced8c4a2c233ce5661c1cd1f07200cb5851a /src
parent29d3b9745b4ba57cd79c95a96659f97c85c3b4ee (diff)
Correctly update QComboBox appearance on editable change
The updateDelegate() function checks isEditable() which in turn checks if d->lineEdit != 0, so we need to make the call after the lineEdit has actually been set/unset, otherwise the change to the delegate will not come until the next time you update the delegate. [ChangeLog][QComboBox] Fixed updating appearance of popup menu when changing the editable state of the combo box. Change-Id: Ib32f36cabd53c2c30d6256484a1eae131419960a Task-number: QTBUG-33537 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qcombobox.cpp3
-rw-r--r--src/widgets/widgets/qcombobox_p.h4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 89dc8bf178..fda37c49de 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1704,8 +1704,6 @@ void QComboBox::setEditable(bool editable)
if (isEditable() == editable)
return;
- d->updateDelegate();
-
QStyleOptionComboBox opt;
initStyleOption(&opt);
if (editable) {
@@ -1726,6 +1724,7 @@ void QComboBox::setEditable(bool editable)
d->lineEdit = 0;
}
+ d->updateDelegate();
d->updateFocusPolicy();
d->viewContainer()->updateTopBottomMargin();
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 67b1aa6943..4e1b4125ab 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -254,7 +254,7 @@ private:
friend class QComboBox;
};
-class QComboMenuDelegate : public QAbstractItemDelegate
+class Q_AUTOTEST_EXPORT QComboMenuDelegate : public QAbstractItemDelegate
{ Q_OBJECT
public:
QComboMenuDelegate(QObject *parent, QComboBox *cmb) : QAbstractItemDelegate(parent), mCombo(cmb) {}
@@ -283,7 +283,7 @@ private:
// Note that this class is intentionally not using QStyledItemDelegate
// Vista does not use the new theme for combo boxes and there might
// be other side effects from using the new class
-class QComboBoxDelegate : public QItemDelegate
+class Q_AUTOTEST_EXPORT QComboBoxDelegate : public QItemDelegate
{ Q_OBJECT
public:
QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {}