@@ -23,6 +23,8 @@ class GraphModel : public QObject
2323 Q_PROPERTY (QAbstractListModel *nodes READ nodes NOTIFY graphChanged);
2424 Q_PROPERTY (int nodeCount READ count NOTIFY graphChanged);
2525 Q_PROPERTY (int edgeCount READ nEdges NOTIFY graphChanged);
26+ Q_PROPERTY (QString location READ location NOTIFY graphChanged);
27+ Q_PROPERTY (bool atRoot READ atRoot NOTIFY graphChanged);
2628
2729 friend GraphNodeModel;
2830 friend GraphEdgeModel;
@@ -31,26 +33,30 @@ class GraphModel : public QObject
3133 GraphModel ();
3234
3335 public:
34- // Access the acutal nodes in the model
36+ // Access the actual nodes in the model
3537 Graph *graph ();
3638
3739 void setGraph (Graph *graph);
3840
3941 // The model for the edges in the graph
4042 GraphEdgeModel *edges ();
41- // The modelfor the nodes in the graph
43+ // The model for the nodes in the graph
4244 QAbstractListModel *nodes ();
4345 // The total number of nodes in the graph
4446 int count ();
4547 // The total number of edges in the graph
4648 int nEdges ();
49+ // The path to the current graph
50+ QString location () const ;
51+ // Whether the current graph has a parent
52+ bool atRoot () const ;
4753
4854 protected:
4955 // The abstract data model for the nodes
5056 GraphNodeModel nodes_;
5157 // The abstract data model for the edges between nodes
5258 GraphEdgeModel edges_;
53- // The graph being modeled
59+ // The graph being modelled
5460 Graph *graph_;
5561 // Graph nodes wrapped in the wrappers
5662 std::vector<NodeWrapper> wrapped_;
@@ -85,4 +91,9 @@ class GraphModel : public QObject
8591
8692 // Add a new node at a specific position
8793 void emplace_back (int x, int y, QVariant type, QVariant name);
94+
95+ // Switch to parent graph
96+ void upLevel ();
97+ // Move into an inner graph
98+ void descend (int index);
8899};
0 commit comments