diff --git a/src/qanGraph.cpp b/src/qanGraph.cpp index 32d34ee7..7ee38cc2 100644 --- a/src/qanGraph.cpp +++ b/src/qanGraph.cpp @@ -1401,6 +1401,13 @@ void Graph::clearSelection() _selectedEdges.clear(); } +bool Graph::hasSelection() const +{ + return (_selectedNodes.size() >= 1 || + _selectedGroups.size() >= 1 || + _selectedEdges.size() >= 1); +} + bool Graph::hasMultipleSelection() const { // Note 20231104: There is still no support for multiple edge selection, @@ -1410,7 +1417,6 @@ bool Graph::hasMultipleSelection() const _selectedEdges.size() > 1; } - std::vector Graph::getSelectedItems() const { using item_vector_t = std::vector; diff --git a/src/qanGraph.h b/src/qanGraph.h index 7325524c..7f5e9416 100644 --- a/src/qanGraph.h +++ b/src/qanGraph.h @@ -762,7 +762,10 @@ class Graph : public gtpo::graph //! Clear the current selection. Q_INVOKABLE void clearSelection(); - //! Return true if multiple node are selected. + //! Return true if either a nodes, groups, edges (or multiple nodes, groups, edges) is selected. + Q_INVOKABLE bool hasSelection() const; + + //! Return true if multiple nodes, groups or edges are selected. Q_INVOKABLE bool hasMultipleSelection() const; public: