diff --git a/autotests/kextracolumnsproxymodeltest.cpp b/autotests/kextracolumnsproxymodeltest.cpp index 75fe9a6..04789cf 100644 --- a/autotests/kextracolumnsproxymodeltest.cpp +++ b/autotests/kextracolumnsproxymodeltest.cpp @@ -112,7 +112,7 @@ private Q_SLOTS: QCOMPARE(extractRowTexts(&mod, 0), QStringLiteral("ABCD")); QCOMPARE(extractRowTexts(&mod, 0, mod.index(0, 0)), QStringLiteral("mnop")); QCOMPARE(extractRowTexts(&mod, 1, mod.index(0, 0)), QStringLiteral("qrst")); - QCOMPARE(extractRowTexts(&mod, 0, mod.index(0, 0).child(1, 0)), QStringLiteral("uvww")); + QCOMPARE(extractRowTexts(&mod, 0, mod.index(1, 0, mod.index(0, 0))), QStringLiteral("uvww")); QCOMPARE(extractRowTexts(&mod, 1), QStringLiteral("EFGH")); QCOMPARE(extractRowTexts(&mod, 0, mod.index(1, 0)), QStringLiteral("xyz.")); QCOMPARE(extractHorizontalHeaderTexts(&mod), QStringLiteral("H1H2H3H4")); @@ -325,7 +325,7 @@ private Q_SLOTS: // And a selection QItemSelectionModel selection(&pm); selection.select(pm.index(0, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows); - const QModelIndex grandChild = pm.index(0, 0).child(1, 0).child(0, 0); + const QModelIndex grandChild = pm.index(0, 0, pm.index(1, 0, pm.index(0, 0))); QCOMPARE(grandChild.data().toString(), QStringLiteral("u")); selection.select(grandChild, QItemSelectionModel::Select | QItemSelectionModel::Rows); const QModelIndexList lst = selection.selectedIndexes(); diff --git a/autotests/proxymodeltestsuite/dynamictreemodel.cpp b/autotests/proxymodeltestsuite/dynamictreemodel.cpp index d727607..5159cd5 100644 --- a/autotests/proxymodeltestsuite/dynamictreemodel.cpp +++ b/autotests/proxymodeltestsuite/dynamictreemodel.cpp @@ -433,10 +433,9 @@ void ModelInsertCommand::interpret(const QString &treeString) { m_treeString = treeString; - QList depths = getDepths(m_treeString); + const QList depths = getDepths(m_treeString); - int size = 0; - qCount(depths, 0, size); + const int size = std::count(depths.begin(), depths.end(), 0); Q_ASSERT(size != 0); m_endRow = m_startRow + size - 1; @@ -480,10 +479,8 @@ void ModelInsertCommand::doCommand() QModelIndex parent = findIndex(m_rowNumbers); if (!m_treeString.isEmpty()) { - QList depths = getDepths(m_treeString); - - int size = 0; - qCount(depths, 0, size); + const QList depths = getDepths(m_treeString); + const int size = std::count(depths.begin(), depths.end(), 0); Q_ASSERT(size != 0); m_endRow = m_startRow + size - 1; } @@ -512,7 +509,7 @@ void ModelInsertCommand::doCommand() void ModelInsertCommand::doInsertTree(const QModelIndex &fragmentParent) { - QList depths = getDepths(m_treeString); + const QList depths = getDepths(m_treeString); qint64 fragmentParentIdentifier = fragmentParent.internalId(); diff --git a/tests/proxymodeltestapp/kreparentingproxymodel.cpp b/tests/proxymodeltestapp/kreparentingproxymodel.cpp index 9ada95e..ee62bcd 100644 --- a/tests/proxymodeltestapp/kreparentingproxymodel.cpp +++ b/tests/proxymodeltestapp/kreparentingproxymodel.cpp @@ -220,7 +220,7 @@ QModelIndex KReparentingProxyModelPrivate::getLastDescendant(const QModelIndex & QModelIndex proxyIndex = q->mapFromSource(index); while (q->hasChildren(proxyIndex)) { - proxyIndex = proxyIndex.child(q->rowCount(proxyIndex), proxyIndex.column()); + proxyIndex = q->index(q->rowCount(proxyIndex), proxyIndex.column(), proxyIndex); if (!proxyIndex.isValid()) { break; } @@ -308,7 +308,7 @@ QHash KReparentingProxyModelPrivate::recreateMappi break; } - const QVector::iterator ancestorIt = qLowerBound(ancestors.begin(), ancestors.end(), nextIndex, LessThan(q)); + const QVector::iterator ancestorIt = std::lower_bound(ancestors.begin(), ancestors.end(), nextIndex, LessThan(q)); ancestors.erase(ancestorIt, ancestors.end());