summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/util
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-02-06 22:09:33 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-02-08 18:00:51 +0000
commit1b5a17632efbaf6c1d0eacdda72fad3bc9d5fe13 (patch)
tree336afc751c787a9aa376ef895750d4bce74619a3 /tests/auto/widgets/util
parent4ce485a2eba40cc6d1edcf4baa794276432e1bea (diff)
Fix deprecation warnings in widget autotests
Fix all deprecation warnings within tests/auto/widgets Change-Id: I854f54c0a1dc0a0086f626b93cd39f63cb1b6033 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/widgets/util')
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index ad64f1aef7..8bb16cc9d1 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -1595,27 +1595,16 @@ void tst_QCompleter::task247560_keyboardNavigation()
}
// Helpers for QTBUG_14292_filesystem: Recursion helper for below recurseTreeModel
-template <class Function>
-bool recurseTreeModelIndex(const QModelIndex &idx, Function f, int depth = 0)
-{
- if (f(idx, depth))
- return true;
- const int rowCount = idx.model()->rowCount(idx);
- for (int row = 0; row < rowCount; ++row)
- if (recurseTreeModelIndex(idx.child(row, 0), f, depth + 1))
- return true;
- return false;
-}
-
// Function to recurse over a tree model applying a function
// taking index and depth, returning true to terminate recursion.
-
template <class Function>
-bool recurseTreeModel(const QAbstractItemModel &m, Function f)
+bool recurseTreeModel(const QAbstractItemModel &m, const QModelIndex &idx, Function f, int depth = 0)
{
- const int rowCount = m.rowCount(QModelIndex());
+ if (idx.isValid() && f(idx, depth))
+ return true;
+ const int rowCount = m.rowCount(idx);
for (int row = 0; row < rowCount; ++row)
- if (recurseTreeModelIndex(m.index(row, 0, QModelIndex()), f))
+ if (recurseTreeModel(m, m.index(row, 0, idx), f, depth + 1))
return true;
return false;
}
@@ -1658,7 +1647,7 @@ QDebug operator<<(QDebug d, const QAbstractItemModel &m)
{
QDebug dns = d.nospace();
dns << '\n';
- recurseTreeModel(m, DebugFunction(dns));
+ recurseTreeModel(m, QModelIndex(), DebugFunction(dns));
return d;
}
@@ -1671,8 +1660,8 @@ static const char testDir2[] = "holla";
static inline bool testFileSystemReady(const QAbstractItemModel &model)
{
- return recurseTreeModel(model, SearchFunction(QLatin1String(testDir1), QFileSystemModel::FileNameRole))
- && recurseTreeModel(model, SearchFunction(QLatin1String(testDir2), QFileSystemModel::FileNameRole));
+ return recurseTreeModel(model, QModelIndex(), SearchFunction(QLatin1String(testDir1), QFileSystemModel::FileNameRole))
+ && recurseTreeModel(model, QModelIndex(), SearchFunction(QLatin1String(testDir2), QFileSystemModel::FileNameRole));
}
void tst_QCompleter::QTBUG_14292_filesystem()