ui: GraphView can set active tokenId on node clicked

By now the graph displays the active node, without neighbours or anything, and clicking a node sets the active token id to the clicked nodes id.

fortune cookie message = Be prepared to accept an exciting opportunity in the future.
This commit is contained in:
Manuel Dobusch
2014-07-07 16:53:44 +02:00
parent e38914887d
commit 0f60a9a556
14 changed files with 215 additions and 62 deletions
+17 -2
View File
@@ -1,8 +1,12 @@
#ifndef QT_GRAPH_VIEW_H
#define QT_GRAPH_VIEW_H
#include "qt/utility/QtThreadedFunctor.h"
#include "component/view/GraphView.h"
struct DummyEdge;
struct DummyNode;
class QGraphicsView;
class QtGraphView : public GraphView
@@ -15,11 +19,22 @@ public:
virtual void createWidgetWrapper();
virtual void initGui();
virtual std::weak_ptr<GraphNode> addNode(const Vec2i& position, const std::string& name);
virtual void addEdge(const std::weak_ptr<GraphNode>& owner, const std::weak_ptr<GraphNode>& target);
virtual void rebuildGraph(const std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges);
virtual void clear();
private:
QGraphicsView* getView();
void doRebuildGraph(const std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges);
void doClear();
std::shared_ptr<GraphNode> findOrCreateNode(QGraphicsView* view, const DummyNode& node);
std::shared_ptr<GraphNode> findNode(const DummyNode& node);
std::shared_ptr<GraphNode> createNode(QGraphicsView* view, const DummyNode& node);
QtThreadedFunctor<const std::vector<DummyNode>&, const std::vector<DummyEdge>&> m_rebuildGraph;
QtThreadedFunctor<void> m_clear;
};
#endif // QT_GRAPH_VIEW_H