summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-07-12 16:02:53 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-07-13 13:45:44 +0000
commit9131f6e56139924162778c6c0538dda58d839bbb (patch)
tree67b226fc8f98326592e30c1c36222aafe6af2ca7 /src/widgets
parent4397a1b26c244dc4cd0d3826e0c4135ec9003914 (diff)
QCompleter::setModel(): Restore completion role
When setting a QFileSystemModel as model, the completion role is set to QFileSystemModel::FileNameRole. This needs to be reset to the default Qt::EditRole when setting another model. Task-number: QTBUG-54642 Change-Id: Ie78d5d417e008ad05a2f995bdbc218b3ad1bc49c Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/widgets')
-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 55bb51d0a3..a036071893 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1038,6 +1038,10 @@ void QCompleter::setModel(QAbstractItemModel *model)
{
Q_D(QCompleter);
QAbstractItemModel *oldModel = d->proxy->sourceModel();
+#ifndef QT_NO_FILESYSTEMMODEL
+ if (qobject_cast<const QFileSystemModel *>(oldModel))
+ setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel
+#endif
d->proxy->setSourceModel(model);
if (d->popup)
setPopup(d->popup); // set the model and make new connections