diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 14:46:06 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 13:47:53 +0000 |
commit | 8eb4d52342fe3a6ede1c1dce3174d95bfa0cea88 (patch) | |
tree | 0f5556c5e4098e75853e3d9ee2620e0306f0cf2a /src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp | |
parent | 90de29d530dfc2921d5179977b3393c11a3cc238 (diff) |
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp')
-rw-r--r-- | src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp index 1cfe0ba95f..07bcf0b705 100644 --- a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp +++ b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp @@ -112,7 +112,7 @@ void ScxmlDocument::addNamespace(ScxmlNamespace *ns) ScxmlTag *scxmlTag = scxmlRootTag(); if (scxmlTag) { - for (ScxmlNamespace *ns : qAsConst(m_namespaces)) { + for (ScxmlNamespace *ns : std::as_const(m_namespaces)) { QString prefix = ns->prefix(); if (prefix.isEmpty()) prefix = "xmlns"; @@ -149,7 +149,7 @@ bool ScxmlDocument::generateSCXML(QIODevice *io, ScxmlTag *tag) const ScxmlTag *ScxmlDocument::createScxmlTag() { auto tag = new ScxmlTag(Scxml, this); - for (ScxmlNamespace *ns : qAsConst(m_namespaces)) { + for (ScxmlNamespace *ns : std::as_const(m_namespaces)) { QString prefix = ns->prefix(); if (prefix.isEmpty()) prefix = "xmlns"; @@ -291,7 +291,7 @@ bool ScxmlDocument::pasteData(const QByteArray &data, const QPointF &minPos, con QBuffer buffer(&d); buffer.open(QIODevice::ReadOnly); QXmlStreamReader xml(&buffer); - for (ScxmlNamespace *ns : qAsConst(m_namespaces)) { + for (ScxmlNamespace *ns : std::as_const(m_namespaces)) { xml.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration(ns->prefix(), ns->name())); } @@ -576,7 +576,7 @@ QString ScxmlDocument::nextUniqueId(const QString &key) name = QString::fromLatin1("%1_%2").arg(key).arg(id); // Check duplicate - for (const ScxmlTag *tag : qAsConst(m_tags)) { + for (const ScxmlTag *tag : std::as_const(m_tags)) { if (tag->attribute("id") == name) { bFound = true; break; @@ -598,7 +598,7 @@ QString ScxmlDocument::getUniqueCopyId(const ScxmlTag *tag) while (true) { bFound = false; // Check duplicate - for (const ScxmlTag *t : qAsConst(m_tags)) { + for (const ScxmlTag *t : std::as_const(m_tags)) { if (t->attribute("id") == name && t != tag) { name = QString::fromLatin1("%1_Copy%2").arg(key).arg(counter); bFound = true; |