diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2014-12-18 16:07:27 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2014-12-20 06:36:29 +0100 |
commit | 95092e20113c3c69332b67a50e0c104cebb96932 (patch) | |
tree | 854d1ca1b1211f926475d94a8cfa701b3422d9ea /src/widgets | |
parent | ebd33883e79b458639e8fe118ccc285641223203 (diff) |
Make setting twice the very same model on QComboBox a no-op
Basically, introduce a small check for this corner-case situation.
Setting a model doesn't just store a pointer, but also resets the current
index, changes the line edit completion model, and so on, and seems silly
to trigger changes in such cases.
[ChangeLog][QtWidgets][QComboBox] A QComboBox does not reset itself any
more when setting the same model more than once.
Change-Id: If028b36cdfaa5552c156dd900e123ca9a04d4e3d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 40cf2f0f95..a83aecf52c 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1931,6 +1931,9 @@ void QComboBox::setModel(QAbstractItemModel *model) return; } + if (model == d->model) + return; + #ifndef QT_NO_COMPLETER if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer() == d->completer) |