diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-08-16 11:30:58 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-04 21:27:33 +0200 |
commit | e82a1d6b2998b30fc100c4ebf9b98ee18dd3c374 (patch) | |
tree | 8f9f503cc128fc776e77a4d10b830a6bb0e29b46 /src/widgets | |
parent | efbba1e54ac6f66a3f3f5a9000ae68406c74ca8f (diff) |
Deprecate QDirModel
Deprecate the constructors, add guards.
Use a QStandardItemModel in tst_QCompleter::setters() instead.
Task-number: QTBUG-69410
Change-Id: If77298982bb3d0b5321ae1271fab3f33b196101d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qdirmodel.cpp | 4 | ||||
-rw-r--r-- | src/widgets/itemviews/qdirmodel.h | 11 | ||||
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 10 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index 13a1bbd8eb..ba7ee15314 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -39,6 +39,8 @@ #include "qdirmodel.h" +#if QT_DEPRECATED_SINCE(5, 15) + #include <qfile.h> #include <qfilesystemmodel.h> #include <qurl.h> @@ -1372,3 +1374,5 @@ QFileInfo QDirModelPrivate::resolvedInfo(QFileInfo info) QT_END_NAMESPACE #include "moc_qdirmodel.cpp" + +#endif // QT_DEPRECATED_SINCE(5, 15) diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h index ab91bbd763..665a622dbe 100644 --- a/src/widgets/itemviews/qdirmodel.h +++ b/src/widgets/itemviews/qdirmodel.h @@ -45,6 +45,8 @@ #include <QtCore/qdir.h> #include <QtWidgets/qfileiconprovider.h> +#if QT_DEPRECATED_SINCE(5, 15) + QT_REQUIRE_CONFIG(dirmodel); QT_BEGIN_NAMESPACE @@ -65,9 +67,10 @@ public: FileNameRole }; - QDirModel(const QStringList &nameFilters, QDir::Filters filters, - QDir::SortFlags sort, QObject *parent = nullptr); - explicit QDirModel(QObject *parent = nullptr); + QT_DEPRECATED_VERSION_X_5_15("Use QFileSystemModel") QDirModel(const QStringList &nameFilters, + QDir::Filters filters, QDir::SortFlags sort, + QObject *parent = nullptr); + QT_DEPRECATED_VERSION_X_5_15("Use QFileSystemModel") explicit QDirModel(QObject *parent = nullptr); ~QDirModel(); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; @@ -144,4 +147,6 @@ private: QT_END_NAMESPACE +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif // QDIRMODEL_H diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 7b69eff30c..3c0271e7c2 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -473,7 +473,7 @@ QMatchData QCompletionEngine::filterHistory() if (curParts.count() <= 1 || c->proxy->showAll || !source) return QMatchData(); -#if QT_CONFIG(dirmodel) +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) const bool isDirModel = (qobject_cast<QDirModel *>(source) != nullptr); #else const bool isDirModel = false; @@ -903,7 +903,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); -#if QT_CONFIG(dirmodel) +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) // add a trailing separator in inline if (mode == QCompleter::InlineCompletion) { if (qobject_cast<QDirModel *>(proxy->sourceModel()) && QFileInfo(completion).isDir()) @@ -1125,7 +1125,7 @@ void QCompleter::setModel(QAbstractItemModel *model) setPopup(d->popup); // set the model and make new connections if (oldModel && oldModel->QObject::parent() == this) delete oldModel; -#if QT_CONFIG(dirmodel) +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) if (qobject_cast<QDirModel *>(model)) { #if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); @@ -1846,7 +1846,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const return QString(); bool isDirModel = false; bool isFsModel = false; -#if QT_CONFIG(dirmodel) +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != nullptr; #endif #if QT_CONFIG(filesystemmodel) @@ -1895,7 +1895,7 @@ QStringList QCompleter::splitPath(const QString& path) const { bool isDirModel = false; bool isFsModel = false; -#if QT_CONFIG(dirmodel) +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) Q_D(const QCompleter); isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != nullptr; #endif |