From 007058209f1b94d462b933a00c9b155de1e18a4d Mon Sep 17 00:00:00 2001 From: cneben Date: Wed, 22 May 2024 15:04:01 +0200 Subject: [PATCH] Add qan::Graph::updateMinMaxZ(). Signed-off-by: cneben --- src/qanGraph.cpp | 6 ++++-- src/qanGraph.h | 13 ++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qanGraph.cpp b/src/qanGraph.cpp index d0864209..bc3ff23e 100644 --- a/src/qanGraph.cpp +++ b/src/qanGraph.cpp @@ -1831,11 +1831,13 @@ void Graph::sendToBack(QQuickItem* item) nodeItem->setZ(z); } -/*void Graph::findMaxZ() noexcept +void Graph::updateMinMaxZ() noexcept { const auto maxZ = maxChildsZ(getContainerItem()); setMaxZ(maxZ); -}*/ + const auto minZ = minChildsZ(getContainerItem()); + setMaxZ(minZ); +} qreal Graph::getMaxZ() const noexcept { return _maxZ; } void Graph::setMaxZ(const qreal maxZ) noexcept diff --git a/src/qanGraph.h b/src/qanGraph.h index 493c2da9..e4c90981 100644 --- a/src/qanGraph.h +++ b/src/qanGraph.h @@ -994,13 +994,12 @@ class Graph : public gtpo::graph Q_INVOKABLE void sendToBack(QQuickItem* item); public: - /*! \brief Iterate over all graph container items, find and update the maxZ property. + /*! \brief Iterate over all graph container items, find and update the minZ and maxZ property. * * \note O(N) with N beeing the graph item count (might be quite costly, mainly defined to update * maxZ after in serialization for example). */ - // FIXME #1718 never called - //Q_INVOKABLE void findMaxZ() noexcept; + Q_INVOKABLE void updateMinMaxZ() noexcept; /*! \brief Maximum global z for nodes and groups (ie top-most item). * @@ -1028,14 +1027,6 @@ class Graph : public gtpo::graph static auto maxChildsZ(const QQuickItem* item) noexcept -> qreal; public: - /*! \brief Iterate over all graph container items, find and update the minZ property. - * - * \note O(N) with N beeing the graph item count (might be quite costly, mainly defined to update - * maxZ after in serialization for example). - */ - // FIXME #1718 never called - //Q_INVOKABLE void findMaxZ() noexcept; - //! \brief Minimum global z for nodes and groups (ie bottom-less item). Q_PROPERTY(qreal minZ READ getMinZ WRITE setMinZ NOTIFY minZChanged FINAL) qreal getMinZ() const noexcept;