Repository navigation
Expand file tree
/
Copy pathFSMView.h
More file actions
58 lines (47 loc) · 1.32 KB
/
Copy pathFSMView.h
File metadata and controls
58 lines (47 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <QGraphicsView>
#include <QGraphicsScene>
/**
* @brief A view on the FSMScene.
*
* Each scene can have multiple scenes. This class provides the main view
* and handles camera move and zoom.
*/
class FSMView : public QGraphicsView
{
Q_OBJECT;
using super = QGraphicsView;
public:
FSMView(QGraphicsScene* scene, QWidget* parent);
/**
* Zoom in, in the graph view.
*/
Q_SLOT void zoomIn();
/**
* Zoom out, in the graph view.
*/
Q_SLOT void zoomOut();
/**
* Called by the wheel events from the scene.
*/
Q_SLOT void zoomView(int delta);
/**
* This method should only be useful to save and load the zoom between sessions.
*/
qreal currentZoom() const;
/**
* This method should only be useful to save and load the zoom between sessions.
*/
void setZoom(qreal zoom);
protected:
virtual void keyPressEvent(QKeyEvent *event) override;
virtual void keyReleaseEvent(QKeyEvent *event) override;
virtual void drawBackground(QPainter * painter, const QRectF & rect) override;
virtual void mousePressEvent(QMouseEvent *) override;
virtual void mouseReleaseEvent(QMouseEvent *) override;
/**
* Switch between scroll mode and the default drag mode, which is RubberBandMode.
*/
void setScrollMode(bool on);
QMouseEvent* copyMouseEventLeft(QMouseEvent* e);
};