summaryrefslogtreecommitdiffstats
path: root/src/widgets/util
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-08-25 16:16:12 +0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-08-28 07:10:48 +0000
commitf1a857c079e11c8e298ec8f2dafef49039f8ca40 (patch)
tree35909bf9a9a3be6cb9b5becbbe4c2392f7935399 /src/widgets/util
parentdb0585d63ad44756c9b9476a53413ccd061c52d8 (diff)
QCompleter: Add check before setting the widget
This prevents unnecessarily removing and reinstalling the completer as event filter on the same widget. This does not prevent what's going on in QComboBox::focusInEvent(), where we'd set the line edit as widget just to immediately override it with combo box itself. Change-Id: I70c081a920f4daf4d7560e5cd7158e4070042d42 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets/util')
-rw-r--r--src/widgets/util/qcompleter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 9ae0384020..a9ab0c22c8 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1013,11 +1013,15 @@ QCompleter::~QCompleter()
void QCompleter::setWidget(QWidget *widget)
{
Q_D(QCompleter);
+ if (widget == d->widget)
+ return;
+
if (d->widget)
d->widget->removeEventFilter(this);
d->widget = widget;
if (d->widget)
d->widget->installEventFilter(this);
+
if (d->popup) {
d->popup->hide();
d->popup->setFocusProxy(d->widget);