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>
This commit is contained in:
parent
db0585d63a
commit
f1a857c079
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user