summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-07-22 15:11:58 +0200
committerStephan Binner <stephan.binner@basyskom.com>2017-07-25 11:23:33 +0000
commit43b7c0c609ad4f01a392eb081a6d41adb80a92c7 (patch)
tree7395a764796a6e67610d3b1ad912581903d34c97
parentfcfee98f62b8a8b8c3b1ac11cbb23620788a586c (diff)
Convert features.dirmodel to QT_[REQUIRE_]CONFIG
Change-Id: I8e2c6b49857ffb292c4b08ccab560c59665cc3a4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r--src/widgets/itemviews/itemviews.pri7
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp3
-rw-r--r--src/widgets/itemviews/qdirmodel.h7
-rw-r--r--src/widgets/util/qcompleter.cpp16
4 files changed, 16 insertions, 17 deletions
diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri
index effe9017e9..bdab346522 100644
--- a/src/widgets/itemviews/itemviews.pri
+++ b/src/widgets/itemviews/itemviews.pri
@@ -10,7 +10,6 @@ HEADERS += \
itemviews/qabstractitemdelegate.h \
itemviews/qabstractitemdelegate_p.h \
itemviews/qitemdelegate.h \
- itemviews/qdirmodel.h \
itemviews/qwidgetitemdata_p.h \
itemviews/qitemeditorfactory.h \
itemviews/qitemeditorfactory_p.h \
@@ -23,7 +22,6 @@ SOURCES += \
itemviews/qbsptree.cpp \
itemviews/qabstractitemdelegate.cpp \
itemviews/qitemdelegate.cpp \
- itemviews/qdirmodel.cpp \
itemviews/qitemeditorfactory.cpp \
itemviews/qdatawidgetmapper.cpp \
itemviews/qstyleditemdelegate.cpp
@@ -40,6 +38,11 @@ qtConfig(columnview) {
itemviews/qcolumnviewgrip.cpp
}
+qtConfig(dirmodel) {
+ HEADERS += itemviews/qdirmodel.h
+ SOURCES += itemviews/qdirmodel.cpp
+}
+
qtConfig(listview) {
HEADERS += \
itemviews/qlistview.h \
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 5526da8509..2cf76262e6 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -39,7 +39,6 @@
#include "qdirmodel.h"
-#ifndef QT_NO_DIRMODEL
#include <qfile.h>
#include <qfilesystemmodel.h>
#include <qurl.h>
@@ -1389,5 +1388,3 @@ QFileInfo QDirModelPrivate::resolvedInfo(QFileInfo info)
QT_END_NAMESPACE
#include "moc_qdirmodel.cpp"
-
-#endif // QT_NO_DIRMODEL
diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index 90a9809986..30810cf4f6 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -45,10 +45,9 @@
#include <QtCore/qdir.h>
#include <QtWidgets/qfileiconprovider.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(dirmodel);
-#ifndef QT_NO_DIRMODEL
+QT_BEGIN_NAMESPACE
class QDirModelPrivate;
@@ -143,8 +142,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_refresh())
};
-#endif // QT_NO_DIRMODEL
-
QT_END_NAMESPACE
#endif // QDIRMODEL_H
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 9119c7896f..9ae0384020 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -147,7 +147,9 @@
#include "QtWidgets/qscrollbar.h"
#include "QtCore/qstringlistmodel.h"
+#if QT_CONFIG(dirmodel)
#include "QtWidgets/qdirmodel.h"
+#endif
#if QT_CONFIG(filesystemmodel)
#include "QtWidgets/qfilesystemmodel.h"
#endif
@@ -465,7 +467,7 @@ QMatchData QCompletionEngine::filterHistory()
if (curParts.count() <= 1 || c->proxy->showAll || !source)
return QMatchData();
-#ifndef QT_NO_DIRMODEL
+#if QT_CONFIG(dirmodel)
const bool isDirModel = (qobject_cast<QDirModel *>(source) != 0);
#else
const bool isDirModel = false;
@@ -869,7 +871,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
QModelIndex si = proxy->mapToSource(index);
si = si.sibling(si.row(), column); // for clicked()
completion = q->pathFromIndex(si);
-#ifndef QT_NO_DIRMODEL
+#if QT_CONFIG(dirmodel)
// add a trailing separator in inline
if (mode == QCompleter::InlineCompletion) {
if (qobject_cast<QDirModel *>(proxy->sourceModel()) && QFileInfo(completion).isDir())
@@ -1057,7 +1059,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
setPopup(d->popup); // set the model and make new connections
if (oldModel && oldModel->QObject::parent() == this)
delete oldModel;
-#ifndef QT_NO_DIRMODEL
+#if QT_CONFIG(dirmodel)
if (qobject_cast<QDirModel *>(model)) {
#if defined(Q_OS_WIN)
setCaseSensitivity(Qt::CaseInsensitive);
@@ -1065,7 +1067,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
setCaseSensitivity(Qt::CaseSensitive);
#endif
}
-#endif // QT_NO_DIRMODEL
+#endif // QT_CONFIG(dirmodel)
#if QT_CONFIG(filesystemmodel)
QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model);
if (fsModel) {
@@ -1771,7 +1773,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
return QString();
bool isDirModel = false;
bool isFsModel = false;
-#ifndef QT_NO_DIRMODEL
+#if QT_CONFIG(dirmodel)
isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0;
#endif
#if QT_CONFIG(filesystemmodel)
@@ -1820,12 +1822,12 @@ QStringList QCompleter::splitPath(const QString& path) const
{
bool isDirModel = false;
bool isFsModel = false;
-#ifndef QT_NO_DIRMODEL
+#if QT_CONFIG(dirmodel)
Q_D(const QCompleter);
isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0;
#endif
#if QT_CONFIG(filesystemmodel)
-#ifdef QT_NO_DIRMODEL
+#if !QT_CONFIG(dirmodel)
Q_D(const QCompleter);
#endif
isFsModel = qobject_cast<QFileSystemModel *>(d->proxy->sourceModel()) != 0;