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 /tests/auto/corelib/itemmodels | |
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 'tests/auto/corelib/itemmodels')
-rw-r--r-- | tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index 354190e754..d61d45bc52 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -90,7 +90,9 @@ ModelsToTest::ModelsToTest() { setupDatabase(); +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) tests.append(test("QDirModel", ReadOnly, HasData)); +#endif tests.append(test("QStringListModel", ReadWrite, HasData)); tests.append(test("QStringListModelEmpty", ReadWrite, Empty)); @@ -165,11 +167,16 @@ QAbstractItemModel *ModelsToTest::createModel(const QString &modelType) return model; } +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED if (modelType == "QDirModel") { QDirModel *model = new QDirModel(); model->setReadOnly(false); return model; } +QT_WARNING_POP +#endif if (modelType == "QSqlQueryModel") { QSqlQueryModel *model = new QSqlQueryModel(); @@ -287,6 +294,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) return returnIndex; } +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) if (QDirModel *dirModel = qobject_cast<QDirModel *>(model)) { m_dirModelTempDir.reset(new QTemporaryDir); if (!m_dirModelTempDir->isValid()) @@ -303,6 +311,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) } return dirModel->index(tempDir.path()); } +#endif // QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) if (QSqlQueryModel *queryModel = qobject_cast<QSqlQueryModel *>(model)) { QSqlQuery q; @@ -359,11 +368,12 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) */ void ModelsToTest::cleanupTestArea(QAbstractItemModel *model) { - if (qobject_cast<QDirModel *>(model)) { - m_dirModelTempDir.reset(); - } else if (qobject_cast<QSqlQueryModel *>(model)) { + if (qobject_cast<QSqlQueryModel *>(model)) QSqlQuery q("DROP TABLE test"); - } +#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15) + if (qobject_cast<QDirModel *>(model)) + m_dirModelTempDir.reset(); +#endif } void ModelsToTest::setupDatabase() |