Replace deprecated qAsConst with std::as_const

qAsConst was deprecated in Qt 6.6; std::as_const (C++17, already the
project standard) is the drop-in replacement. Clears 46 -Wdeprecated-
declarations warnings across 18 files. No behavioural change.
This commit is contained in:
Dieter Mayer
2026-07-12 21:44:47 +02:00
parent 5c65bf6486
commit 1265e51ebe
18 changed files with 46 additions and 46 deletions
+10 -10
View File
@@ -178,7 +178,7 @@ Diagram::~Diagram()
continue;
deletable_items.append(qgi);
}
for (const auto &item : qAsConst(deletable_items))
for (const auto &item : std::as_const(deletable_items))
{
removeItem(item);
delete item;
@@ -1499,12 +1499,12 @@ bool Diagram::fromXml(QDomElement &document,
if (position != QPointF())
{
QVector <QGraphicsItem *> added_items;
for (auto element : qAsConst(added_elements )) added_items << element;
for (auto shape : qAsConst(added_shapes )) added_items << shape;
for (auto text : qAsConst(added_texts )) added_items << text;
for (auto image : qAsConst(added_images )) added_items << image;
for (auto table : qAsConst(added_tables )) added_items << table;
for (const auto &strip : qAsConst(added_strips)) added_items << strip;
for (auto element : std::as_const(added_elements )) added_items << element;
for (auto shape : std::as_const(added_shapes )) added_items << shape;
for (auto text : std::as_const(added_texts )) added_items << text;
for (auto image : std::as_const(added_images )) added_items << image;
for (auto table : std::as_const(added_tables )) added_items << table;
for (const auto &strip : std::as_const(added_strips)) added_items << strip;
//Get the top left corner of the rectangle that contain all added items
QRectF items_rect;
@@ -1640,11 +1640,11 @@ void Diagram::refreshContents()
conductor->refreshText();
}
for (auto &table : qAsConst(dc_.m_tables)) {
for (auto &table : std::as_const(dc_.m_tables)) {
table->initLink();
}
for (auto &strip :qAsConst(dc_.m_terminal_strip)) {
for (auto &strip :std::as_const(dc_.m_terminal_strip)) {
strip->refreshPending();
}
}
@@ -1829,7 +1829,7 @@ void Diagram::invertSelection()
item_list << item;
}
}
for (auto item : qAsConst(item_list)) {
for (auto item : std::as_const(item_list)) {
item -> setSelected(!item -> isSelected());
}