diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 17:46:16 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 17:46:34 +0200 |
commit | 440286655e0ca271506cf7cc02ad0dbf4baef9ca (patch) | |
tree | 896fa81adb8b14a69355a3a6cf64d06ec8173c9a /tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp | |
parent | 1e27ad1697187549151657ba187928e439300db7 (diff) | |
parent | e164d61ca8263fc4b46fdd916e1ea77c7dd2b735 (diff) | |
download | qtbase-440286655e0ca271506cf7cc02ad0dbf4baef9ca.tar.gz |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
Diffstat (limited to 'tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp')
-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() |