summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/itemmodels
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-06-03 11:26:24 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-06-04 19:11:19 +0200
commit94dcb5454f0f8f144568dff7a9dd1316046ee197 (patch)
tree7da0e7c6708999abc9b4cd88ee7e83aa996b18e2 /tests/auto/corelib/itemmodels
parent5781ef2013160ba3810ad7df399aa79be085cd6c (diff)
Remove the deprecated QDirModel
QFileSystemModel is the documented replacement. It uses threads to populate the model, which QDirModel doesn't. Change-Id: I7818ecd8f849eb566ac176612f382e17a0471c47 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/corelib/itemmodels')
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp41
1 files changed, 2 insertions, 39 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
index d61d45bc52..8ceb621e42 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
@@ -83,16 +83,13 @@ private:
Add new tests, they can be the same model, but in a different state.
The name of the model is passed to createModel
- If readOnly is true the remove tests will be skipped. Example: QDirModel is disabled.
- If createModel returns an empty model. Example: QDirModel does not
+ If readOnly is true the remove tests will be skipped. Example: QSqlQueryModel is disabled.
+ If createModel returns an empty model.
*/
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));
@@ -167,17 +164,6 @@ 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();
populateTestArea(model);
@@ -294,25 +280,6 @@ 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())
- qFatal("Cannot create temporary directory \"%s\": %s",
- qPrintable(QDir::toNativeSeparators(m_dirModelTempDir->path())),
- qPrintable(m_dirModelTempDir->errorString()));
-
- QDir tempDir(m_dirModelTempDir->path());
- for (int i = 0; i < 26; ++i) {
- const QString subdir = QLatin1String("foo_") + QString::number(i);
- if (!tempDir.mkdir(subdir))
- qFatal("Cannot create directory %s",
- qPrintable(QDir::toNativeSeparators(tempDir.path() + QLatin1Char('/') +subdir)));
- }
- return dirModel->index(tempDir.path());
- }
-#endif // QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15)
-
if (QSqlQueryModel *queryModel = qobject_cast<QSqlQueryModel *>(model)) {
QSqlQuery q;
q.exec("CREATE TABLE test(id int primary key, name varchar(30))");
@@ -370,10 +337,6 @@ void ModelsToTest::cleanupTestArea(QAbstractItemModel *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()