summaryrefslogtreecommitdiffstats
path: root/src/widgets/util/qcompleter.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-07-04 15:19:36 +0200
committerLiang Qi <liang.qi@qt.io>2017-07-04 16:05:53 +0200
commitc2b224a758ce7e6dcf3748444fa8e29ab81904be (patch)
tree277cb99bf054190c935579142506caa4ec9861dd /src/widgets/util/qcompleter.cpp
parent10de063ff12cdba07b4620182aced8ed05ee3505 (diff)
parenteaee1209f0ead5be786e81db8aee604ccfea85b0 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
Diffstat (limited to 'src/widgets/util/qcompleter.cpp')
-rw-r--r--src/widgets/util/qcompleter.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index e22f0e7f28..96f91188b8 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -148,7 +148,9 @@
#include "QtWidgets/qscrollbar.h"
#include "QtCore/qstringlistmodel.h"
#include "QtWidgets/qdirmodel.h"
+#if QT_CONFIG(filesystemmodel)
#include "QtWidgets/qfilesystemmodel.h"
+#endif
#include "QtWidgets/qheaderview.h"
#include "QtWidgets/qlistview.h"
#include "QtWidgets/qapplication.h"
@@ -467,7 +469,7 @@ QMatchData QCompletionEngine::filterHistory()
const bool isDirModel = false;
#endif
Q_UNUSED(isDirModel)
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
const bool isFsModel = (qobject_cast<QFileSystemModel *>(source) != 0);
#else
const bool isFsModel = false;
@@ -889,7 +891,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
completion += QDir::separator();
}
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
// add a trailing separator in inline
if (mode == QCompleter::InlineCompletion) {
if (qobject_cast<QFileSystemModel *>(proxy->sourceModel()) && QFileInfo(completion).isDir())
@@ -1061,7 +1063,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
{
Q_D(QCompleter);
QAbstractItemModel *oldModel = d->proxy->sourceModel();
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
if (qobject_cast<const QFileSystemModel *>(oldModel))
setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel
#endif
@@ -1079,7 +1081,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
#endif
}
#endif // QT_NO_DIRMODEL
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model);
if (fsModel) {
#if defined(Q_OS_WIN)
@@ -1090,7 +1092,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
setCompletionRole(QFileSystemModel::FileNameRole);
connect(fsModel, SIGNAL(directoryLoaded(QString)), this, SLOT(_q_fileSystemModelDirectoryLoaded(QString)));
}
-#endif // QT_NO_FILESYSTEMMODEL
+#endif // QT_CONFIG(filesystemmodel)
}
/*!
@@ -1787,7 +1789,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
#ifndef QT_NO_DIRMODEL
isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0;
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
isFsModel = qobject_cast<QFileSystemModel *>(d->proxy->sourceModel()) != 0;
#endif
if (!isDirModel && !isFsModel)
@@ -1799,7 +1801,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
QString t;
if (isDirModel)
t = sourceModel->data(idx, Qt::EditRole).toString();
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
else
t = sourceModel->data(idx, QFileSystemModel::FileNameRole).toString();
#endif
@@ -1837,7 +1839,7 @@ QStringList QCompleter::splitPath(const QString& path) const
Q_D(const QCompleter);
isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0;
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
#ifdef QT_NO_DIRMODEL
Q_D(const QCompleter);
#endif