Convert features.filesystemmodel to QT_[REQUIRE_]CONFIG
Change-Id: I862510387e79d04221ec075f3e79896908ee9d8f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
341554e343
commit
2fb9705521
@ -50,7 +50,9 @@
|
||||
#endif
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#if QT_CONFIG(filesystemmodel)
|
||||
#include <QtWidgets/qfilesystemmodel.h>
|
||||
#endif
|
||||
#include <QtWidgets/qstyleditemdelegate.h>
|
||||
#include <QtPrintSupport/qprinter.h>
|
||||
|
||||
@ -677,7 +679,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter *
|
||||
}
|
||||
widget.properties->setEnabled(true);
|
||||
|
||||
#if !defined(QT_NO_FILESYSTEMMODEL) && !defined(QT_NO_COMPLETER)
|
||||
#if QT_CONFIG(filesystemmodel) && !defined(QT_NO_COMPLETER)
|
||||
QFileSystemModel *fsm = new QFileSystemModel(widget.filename);
|
||||
fsm->setRootPath(QDir::homePath());
|
||||
widget.filename->setCompleter(new QCompleter(fsm, widget.filename));
|
||||
|
@ -2,16 +2,11 @@
|
||||
|
||||
HEADERS += \
|
||||
dialogs/qfontdialog.h \
|
||||
dialogs/qfontdialog_p.h \
|
||||
dialogs/qfilesystemmodel.h \
|
||||
dialogs/qfilesystemmodel_p.h \
|
||||
dialogs/qfileinfogatherer_p.h
|
||||
dialogs/qfontdialog_p.h
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
SOURCES += \
|
||||
dialogs/qfontdialog.cpp \
|
||||
dialogs/qfilesystemmodel.cpp \
|
||||
dialogs/qfileinfogatherer.cpp
|
||||
dialogs/qfontdialog.cpp
|
||||
|
||||
qtConfig(colordialog) {
|
||||
HEADERS += dialogs/qcolordialog.h
|
||||
@ -45,6 +40,17 @@ qtConfig(filedialog) {
|
||||
FORMS += dialogs/qfiledialog.ui
|
||||
}
|
||||
|
||||
qtConfig(filesystemmodel) {
|
||||
HEADERS += \
|
||||
dialogs/qfilesystemmodel.h \
|
||||
dialogs/qfilesystemmodel_p.h \
|
||||
dialogs/qfileinfogatherer_p.h
|
||||
|
||||
SOURCES += \
|
||||
dialogs/qfilesystemmodel.cpp \
|
||||
dialogs/qfileinfogatherer.cpp
|
||||
}
|
||||
|
||||
qtConfig(fscompleter) {
|
||||
HEADERS += dialogs/qfscompleter_p.h
|
||||
}
|
||||
|
@ -50,8 +50,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMMODEL
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||
Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
|
||||
@ -366,8 +364,6 @@ void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bo
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_NO_FILESYSTEMMODEL
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qfileinfogatherer_p.cpp"
|
||||
|
@ -66,6 +66,8 @@
|
||||
|
||||
#include <private/qfilesystemengine_p.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(filesystemmodel);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QExtendedInformation {
|
||||
@ -150,8 +152,6 @@ private :
|
||||
|
||||
class QFileIconProvider;
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMMODEL
|
||||
|
||||
class Q_AUTOTEST_EXPORT QFileInfoGatherer : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -208,9 +208,6 @@ private:
|
||||
QFileIconProvider *m_iconProvider; // not accessed by run()
|
||||
QFileIconProvider defaultProvider;
|
||||
};
|
||||
#endif // QT_NO_FILESYSTEMMODEL
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QFILEINFOGATHERER_H
|
||||
|
||||
|
@ -58,8 +58,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMMODEL
|
||||
|
||||
/*!
|
||||
\enum QFileSystemModel::Roles
|
||||
\value FileIconRole
|
||||
@ -1995,5 +1993,3 @@ bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qfilesystemmodel.cpp"
|
||||
|
||||
#endif // QT_NO_FILESYSTEMMODEL
|
||||
|
@ -47,11 +47,10 @@
|
||||
#include <QtGui/qicon.h>
|
||||
#include <QtCore/qdiriterator.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(filesystemmodel);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMMODEL
|
||||
|
||||
class ExtendedInformation;
|
||||
class QFileSystemModelPrivate;
|
||||
class QFileIconProvider;
|
||||
@ -166,9 +165,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const
|
||||
inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const
|
||||
{ return qvariant_cast<QIcon>(aindex.data(Qt::DecorationRole)); }
|
||||
|
||||
#endif // QT_NO_FILESYSTEMMODEL
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QFILESYSTEMMODEL_H
|
||||
|
||||
|
@ -54,8 +54,6 @@
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
#include "qfilesystemmodel.h"
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMMODEL
|
||||
|
||||
#include <private/qabstractitemmodel_p.h>
|
||||
#include <qabstractitemmodel.h>
|
||||
#include "qfileinfogatherer_p.h"
|
||||
@ -66,6 +64,8 @@
|
||||
#include <qtimer.h>
|
||||
#include <qhash.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(filesystemmodel);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class ExtendedInformation;
|
||||
@ -313,9 +313,7 @@ public:
|
||||
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QFileSystemModelPrivate::Fetching, Q_MOVABLE_TYPE);
|
||||
#endif // QT_NO_FILESYSTEMMODEL
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -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;
|
||||
@ -872,7 +874,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())
|
||||
@ -1044,7 +1046,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
|
||||
@ -1062,7 +1064,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)
|
||||
@ -1073,7 +1075,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)
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1770,7 +1772,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)
|
||||
@ -1782,7 +1784,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
|
||||
@ -1820,7 +1822,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
|
||||
|
@ -348,7 +348,7 @@ void tst_QCompleter::getSetCheck()
|
||||
completer.setWrapAround(false);
|
||||
QCOMPARE(completer.wrapAround(), false);
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMMODEL
|
||||
#if QT_CONFIG(filesystemmodel)
|
||||
// QTBUG-54642, changing from QFileSystemModel to another model should restore role.
|
||||
completer.setCompletionRole(Qt::EditRole);
|
||||
QCOMPARE(completer.completionRole(), static_cast<int>(Qt::EditRole)); // default value
|
||||
@ -361,7 +361,7 @@ void tst_QCompleter::getSetCheck()
|
||||
QStandardItemModel standardItemModel2(2, 2); // Do not clobber a custom role when changing models
|
||||
completer.setModel(&standardItemModel2);
|
||||
QCOMPARE(completer.completionRole(), static_cast<int>(Qt::ToolTipRole));
|
||||
#endif // QT_NO_FILESYSTEMMODEL
|
||||
#endif // QT_CONFIG(filesystemmodel)
|
||||
}
|
||||
|
||||
void tst_QCompleter::csMatchingOnCsSortedModel_data()
|
||||
|
Loading…
Reference in New Issue
Block a user