Skip to content

Commit

Permalink
qAsConst is deprecated, use std::as_const
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaure-kdab committed Nov 22, 2024
1 parent 231c19d commit 73cefa8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions qt/KDStlContainerAdaptor/test/tst_KDStlContainerAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion qt/model_view/updateableModel/UpdateableModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class UpdateableModel : public BaseModel
// reconstruct vector of changed roles
QVector<int> roles;
roles.reserve(m_changedRoles.count());
for (int role : qAsConst(m_changedRoles))
for (int role : std::as_const(m_changedRoles))
{
roles.append(role);
}
Expand Down
2 changes: 1 addition & 1 deletion qt/qml/PropertySelector/PropertySelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void PropertySelector::applyRule(PropertyRules &propertyRules, QVector<Rule>::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);
}
Expand Down
2 changes: 1 addition & 1 deletion qt/tabWindow/src/tabwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 73cefa8

Please sign in to comment.