diff options
author | jasplin <qt-info@nokia.com> | 2009-04-03 08:03:56 (GMT) |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2009-04-03 08:26:18 (GMT) |
commit | d684546573785ce40fb5de2b8b3aad88e9958709 (patch) | |
tree | d1481ebcdd37080401ba55aaec591fbf15bea747 /src/gui/util | |
parent | b2a8a4e0297a7850cf938d85fbfd90cd272d15c2 (diff) | |
download | Qt-d684546573785ce40fb5de2b8b3aad88e9958709.zip Qt-d684546573785ce40fb5de2b8b3aad88e9958709.tar.gz Qt-d684546573785ce40fb5de2b8b3aad88e9958709.tar.bz2 |
Fix focus policy propagation bug in QCompleter.
Commit 4a00810cc394b7da99ddb2d13eb045352ede25d3 ensures
that setting the focus policy of a widget applies to its
proxy (if any) as well. This propagation effect is however
unfortunate for a QCompleter in PopupCompletion mode.
The client widget (typically a QLineEdit or a QTextEdit)
acts as the focus proxy to the popup menu. Internally,
the completer sets the focus policy of the popup menu to
NoFocus, but this should not affect the focus policy of
the editor.
Reviewed-by: janarve
Task-number: 250064
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qcompleter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index aeb7e91..7571dfe 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1079,7 +1079,14 @@ void QCompleter::setPopup(QAbstractItemView *popup) popup->setModel(d->proxy); popup->hide(); popup->setParent(0, Qt::Popup); + + Qt::FocusPolicy origPolicy; + if (d->widget) + origPolicy = d->widget->focusPolicy(); popup->setFocusPolicy(Qt::NoFocus); + if (d->widget) + d->widget->setFocusPolicy(origPolicy); + popup->setFocusProxy(d->widget); popup->installEventFilter(this); popup->setItemDelegate(new QCompleterItemDelegate(popup)); |