-
Notifications
You must be signed in to change notification settings - Fork 0
/
Presenter.h~
77 lines (48 loc) · 1.34 KB
/
Presenter.h~
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef __PIROGRONIAN__ELASTIC_BODY_SIMULATOR__PRESENTER__H__
#define __PIROGRONIAN__ELASTIC_BODY_SIMULATOR__PRESENTER__H__
#include <QtGui/QtGui>
#include <QtWidgets/QtWidgets>
#include "ElasticBodySimulator.h"
namespace Pirogronian {
class Presenter;
class GranuleItem : public QGraphicsEllipseItem {
protected:
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
Presenter *_presenter;
public:
ElasticBodySimulator::Granule *granule;
GranuleItem(Presenter *, double x = 0, double y = 0);
void udpatePosition();
void mapPosition();
};
class Presenter : public QWidget {
Q_OBJECT
public:
enum Axis { X, Y, Z };
private:
Axis ax;
int pos;
QList<GranuleItem*> _itemList;
QGraphicsScene *scene;
QGraphicsView *view;
ElasticBodySimulator *sim;
double _scale;
void resizeEvent(QResizeEvent *);
public:
void setAxis(Axis a) { ax = a; }
Axis axis() { return ax; }
void setPos(int i) { pos = i; }
int axisPos() { return pos; }
void setScale(double a) { _scale = a; }
double scale() { return _scale; }
void setSimulator(ElasticBodySimulator *s) { sim = s; }
void setEditable();
void setUneditable();
Presenter(ElasticBodySimulator *s =0, QWidget *parent = 0);
~Presenter();
void init();
public slots:
void update();
};
}
#endif