Skip to content

Commit

Permalink
Add qan::Graph::updateMinMaxZ().
Browse files Browse the repository at this point in the history
Signed-off-by: cneben <[email protected]>
  • Loading branch information
cneben committed May 22, 2024
1 parent 1490e6e commit 0070582
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/qanGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 2 additions & 11 deletions src/qanGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,12 @@ class Graph : public gtpo::graph<QQuickItem, qan::Node, qan::Group, qan::Edge>
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).
*
Expand Down Expand Up @@ -1028,14 +1027,6 @@ class Graph : public gtpo::graph<QQuickItem, qan::Node, qan::Group, qan::Edge>
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;
Expand Down

0 comments on commit 0070582

Please sign in to comment.