From 73cefa8e6c39214902a2343c51fad4a3f4b2cbfa Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 22 Nov 2024 12:19:52 +0100 Subject: [PATCH] qAsConst is deprecated, use std::as_const --- qt/KDStlContainerAdaptor/test/tst_KDStlContainerAdaptor.cpp | 6 +++--- qt/model_view/updateableModel/UpdateableModel.h | 2 +- qt/qml/PropertySelector/PropertySelector.cpp | 2 +- qt/tabWindow/src/tabwindow.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qt/KDStlContainerAdaptor/test/tst_KDStlContainerAdaptor.cpp b/qt/KDStlContainerAdaptor/test/tst_KDStlContainerAdaptor.cpp index bea08f7..deb6673 100644 --- a/qt/KDStlContainerAdaptor/test/tst_KDStlContainerAdaptor.cpp +++ b/qt/KDStlContainerAdaptor/test/tst_KDStlContainerAdaptor.cpp @@ -80,7 +80,7 @@ void tst_KDStlContainerAdaptor::vectorAdaptorDataAccess() QCOMPARE(v.constData()[i], expected); QCOMPARE(v.at(i), expected); QCOMPARE(v[i], expected); - QCOMPARE(qAsConst(v)[i], expected); + QCOMPARE(std::as_const(v)[i], expected); QCOMPARE(v.value(i), expected); } @@ -93,14 +93,14 @@ void tst_KDStlContainerAdaptor::vectorAdaptorDataAccess() QCOMPARE(v.first(), -1); v.first() = 123; QCOMPARE(v.first(), 123); - QCOMPARE(qAsConst(v).first(), 123); + QCOMPARE(std::as_const(v).first(), 123); QCOMPARE(v.constFirst(), 123); v[4] = -1; QCOMPARE(v.last(), -1); v.last() = 456; QCOMPARE(v.last(), 456); - QCOMPARE(qAsConst(v).last(), 456); + QCOMPARE(std::as_const(v).last(), 456); QCOMPARE(v.constLast(), 456); } diff --git a/qt/model_view/updateableModel/UpdateableModel.h b/qt/model_view/updateableModel/UpdateableModel.h index b10e158..cade79c 100644 --- a/qt/model_view/updateableModel/UpdateableModel.h +++ b/qt/model_view/updateableModel/UpdateableModel.h @@ -352,7 +352,7 @@ class UpdateableModel : public BaseModel // reconstruct vector of changed roles QVector roles; roles.reserve(m_changedRoles.count()); - for (int role : qAsConst(m_changedRoles)) + for (int role : std::as_const(m_changedRoles)) { roles.append(role); } diff --git a/qt/qml/PropertySelector/PropertySelector.cpp b/qt/qml/PropertySelector/PropertySelector.cpp index 249d4e1..fb2d550 100644 --- a/qt/qml/PropertySelector/PropertySelector.cpp +++ b/qt/qml/PropertySelector/PropertySelector.cpp @@ -259,7 +259,7 @@ void PropertySelector::applyRule(PropertyRules &propertyRules, QVector::co void PropertySelector::prepareRules() { QStringList conditions; - for (const Rule &rule : qAsConst(m_ruleList)) + for (const Rule &rule : std::as_const(m_ruleList)) { conditions.append(rule.conditions); } diff --git a/qt/tabWindow/src/tabwindow.cpp b/qt/tabWindow/src/tabwindow.cpp index b8df920..9d076f6 100644 --- a/qt/tabWindow/src/tabwindow.cpp +++ b/qt/tabWindow/src/tabwindow.cpp @@ -82,7 +82,7 @@ void TabWindowManager::removeWindow(TabWindow *window) TabWindow *TabWindowManager::possibleWindow(TabWindow *currentWindow, QPoint globalPos) { - for (auto tabWindow : qAsConst(m_windows)) + for (auto tabWindow : std::as_const(m_windows)) { if (tabWindow == currentWindow) continue;