summaryrefslogtreecommitdiffstats
path: root/src/gui/util/qcompleter.cpp
diff options
context:
space:
mode:
authorBenjamin C Meyer <benjamin.meyer@torchmobile.com>2009-07-30 14:59:02 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-07-30 14:59:02 (GMT)
commit4c3cc938ed17e9b98bbdfc9a7e4c5a5b7efd4a3b (patch)
tree544dedee9d860c12522cc280f288851249b942c9 /src/gui/util/qcompleter.cpp
parent2ebebeebd3dacc7192f2f998d324d16bc8cba9fa (diff)
downloadQt-4c3cc938ed17e9b98bbdfc9a7e4c5a5b7efd4a3b.zip
Qt-4c3cc938ed17e9b98bbdfc9a7e4c5a5b7efd4a3b.tar.gz
Qt-4c3cc938ed17e9b98bbdfc9a7e4c5a5b7efd4a3b.tar.bz2
Do not emit activated and close the popup when the item is not enabled.
Autotest: included Merge-request: 378 Reviewed-by: Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>
Diffstat (limited to 'src/gui/util/qcompleter.cpp')
-rw-r--r--src/gui/util/qcompleter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index bf1fa6a..a0a3756 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -824,6 +824,9 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
Q_Q(QCompleter);
QString completion;
+ if (!(index.flags() & Qt::ItemIsEnabled))
+ return;
+
if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) {
completion = prefix;
} else {
@@ -1102,7 +1105,8 @@ void QCompleter::setPopup(QAbstractItemView *popup)
QObject::connect(popup, SIGNAL(clicked(QModelIndex)),
this, SLOT(_q_complete(QModelIndex)));
- QObject::connect(popup, SIGNAL(clicked(QModelIndex)), popup, SLOT(hide()));
+ QObject::connect(this, SIGNAL(activated(QModelIndex)),
+ popup, SLOT(hide()));
QObject::connect(popup->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(_q_completionSelected(QItemSelection)));