2
2
This file is part of Rocs,
3
3
Copyright 2004-2011 Tomaz Canabrava <tomaz.canabrava@gmail.com>
4
Copyright 2013 Andreas Cord-Landwehr <cola@uni-paderborn.de>
5
6
This library is free software; you can redistribute it and/or
6
7
modify it under the terms of the GNU Lesser General Public
25
26
#include "CoreTypes.h"
27
28
class AbstractAction;
31
31
class QGraphicsItem;
34
32
class QGraphicsSceneMouseEvent;
35
33
class QGraphicsSceneWheelEvent;
36
34
class QGraphicsSceneContextMenuEvent;
40
// TODO this interface should not be public
41
// need to refactor VisualGraphEditor to allow that
42
38
class VISUALEDITOR_EXPORT GraphScene : public QGraphicsScene
46
explicit GraphScene(QObject *parent = 0);
47
void updateMinSize(qreal minWidth, qreal minHeight);
42
explicit GraphScene(QObject *parent);
48
43
void setAction(QAction *action);
49
44
void updateGraph(DataStructurePtr g);
50
45
void updateDocument();
51
46
void setActiveGraph(DataStructurePtr g);
48
qreal zoomFactor() const;
54
49
void zoomBy(qreal scaleFactor);
55
50
void zoomTo(qreal scaleFactor);
56
void zoomToRect(QRectF rect);
51
void zoomToRect(const QRectF &rect);
58
void centerOn(QPointF pos);
60
void setHideEdges(bool h);
62
void updateAfter(QGraphicsItem *item);
53
void centerOn(const QPointF &pos);
71
QGraphicsItem* createData(DataPtr n);
72
QGraphicsItem* createEdge(PointerPtr e);
56
QGraphicsItem * createData(DataPtr n);
57
QGraphicsItem * createEdge(PointerPtr e);
73
58
void connectGraphSignals(DataStructurePtr g);
89
void keyPressed(QKeyEvent* key);
90
void keyReleased(QKeyEvent* key);
91
void addData(QPointF pos);
74
void keyPressed(QKeyEvent *key);
75
void keyReleased(QKeyEvent *key);
76
void addData(const QPointF &pos);
92
77
void removeSelected();
93
78
void zoomFactorChanged(qreal zoomFactor);
99
84
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* mouseEvent);
100
85
void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
101
86
void wheelEvent(QGraphicsSceneWheelEvent* wheelEvent);
102
void keyPressEvent(QKeyEvent* keyEvent);
103
void keyReleaseEvent(QKeyEvent* keyEvent);
87
void keyPressEvent(QKeyEvent *keyEvent);
88
void keyReleaseEvent(QKeyEvent *keyEvent);
106
QMenu * createContextMenu(QPointF scenePosition, QPointF screenPosition);
91
QMenu * createContextMenu(const QPointF &scenePosition, const QPointF &screenPosition);
107
92
QMenu *_contextMenu;
108
93
Document *_graphDocument;
109
94
DataStructurePtr _graph;
110
95
AbstractAction *_action;
111
96
QMultiHash<DataStructure*, QGraphicsItem* > _hashGraphs;
112
QList<QGraphicsItem*> _hidedEdges;
113
97
QGraphicsRectItem *_whiteboard;
116
98
void releaseDocument();
119
99
qreal _zoomFactor;