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 /share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d | |
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 'share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp | 16 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp index e805255520..7109bddae0 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp @@ -206,7 +206,7 @@ QVector4D GeneralHelper::focusNodesToCamera(QQuick3DCamera *camera, float defaul totalMinBound = {-halfExtent, -halfExtent, -halfExtent}; totalMaxBound = {halfExtent, halfExtent, halfExtent}; } - for (const auto node : qAsConst(nodeList)) { + for (const auto node : std::as_const(nodeList)) { auto model = qobject_cast<QQuick3DModel *>(node); qreal maxExtent = defaultExtent; QVector3D center = node->scenePosition(); @@ -345,7 +345,7 @@ void GeneralHelper::alignCameras(QQuick3DCamera *camera, const QVariant &nodes) nodeList.append(cameraNode); } - for (QQuick3DCamera *node : qAsConst(nodeList)) { + for (QQuick3DCamera *node : std::as_const(nodeList)) { node->setPosition(camera->position()); node->setRotation(camera->rotation()); } @@ -587,7 +587,7 @@ void GeneralHelper::setMultiSelectionTargets(QQuick3DNode *multiSelectRootNode, // Filter selection to contain only topmost parent nodes in the selection m_multiSelDataMap.clear(); m_multiSelNodes.clear(); - for (auto &connection : qAsConst(m_multiSelectConnections)) + for (auto &connection : std::as_const(m_multiSelectConnections)) disconnect(connection); m_multiSelectConnections.clear(); m_multiSelectRootNode = multiSelectRootNode; @@ -599,7 +599,7 @@ void GeneralHelper::setMultiSelectionTargets(QQuick3DNode *multiSelectRootNode, if (node) selNodes.insert(node); } - for (const auto selNode : qAsConst(selNodes)) { + for (const auto selNode : std::as_const(selNodes)) { bool found = false; QQuick3DNode *parent = selNode->parentNode(); while (parent) { @@ -617,7 +617,7 @@ void GeneralHelper::setMultiSelectionTargets(QQuick3DNode *multiSelectRootNode, // The new selection should be notified by creator immediately after anyway. m_multiSelDataMap.clear(); m_multiSelNodes.clear(); - for (auto &connection : qAsConst(m_multiSelectConnections)) + for (auto &connection : std::as_const(m_multiSelectConnections)) disconnect(connection); m_multiSelectConnections.clear(); })); @@ -643,7 +643,7 @@ void GeneralHelper::resetMultiSelectionNode() m_multiSelNodeData = {}; if (!m_multiSelDataMap.isEmpty()) { - for (const auto &data : qAsConst(m_multiSelDataMap)) + for (const auto &data : std::as_const(m_multiSelDataMap)) m_multiSelNodeData.startScenePos += data.startScenePos; m_multiSelNodeData.startScenePos /= m_multiSelDataMap.size(); } @@ -880,9 +880,9 @@ bool GeneralHelper::getBounds(QQuick3DViewport *view3D, QQuick3DNode *node, QVec }; // Combine all child bounds - for (const auto &newBounds : qAsConst(minBoundsVec)) + for (const auto &newBounds : std::as_const(minBoundsVec)) combineMinBounds(localMinBounds, newBounds); - for (const auto &newBounds : qAsConst(maxBoundsVec)) + for (const auto &newBounds : std::as_const(maxBoundsVec)) combineMaxBounds(localMaxBounds, newBounds); if (qobject_cast<QQuick3DModel *>(node)) { diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp index 6df12f5563..1198047848 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp @@ -31,7 +31,7 @@ SelectionBoxGeometry::SelectionBoxGeometry() SelectionBoxGeometry::~SelectionBoxGeometry() { - for (auto &connection : qAsConst(m_connections)) + for (auto &connection : std::as_const(m_connections)) QObject::disconnect(connection); m_connections.clear(); } @@ -145,7 +145,7 @@ void SelectionBoxGeometry::doUpdateGeometry() GeometryBase::doUpdateGeometry(); - for (auto &connection : qAsConst(m_connections)) + for (auto &connection : std::as_const(m_connections)) QObject::disconnect(connection); m_connections.clear(); @@ -278,9 +278,9 @@ void SelectionBoxGeometry::getBounds( }; // Combine all child bounds - for (const auto &newBounds : qAsConst(minBoundsVec)) + for (const auto &newBounds : std::as_const(minBoundsVec)) combineMinBounds(localMinBounds, newBounds); - for (const auto &newBounds : qAsConst(maxBoundsVec)) + for (const auto &newBounds : std::as_const(maxBoundsVec)) combineMaxBounds(localMaxBounds, newBounds); if (qobject_cast<QQuick3DModel *>(node)) { |