NCL Composer  0.1.5
 All Classes Functions Variables Pages
qnstgraphicscomposition.h
1 #ifndef QNSTGRAPHICSCOMPOSITION_H
2 #define QNSTGRAPHICSCOMPOSITION_H
3 
4 #include "qnst.h"
5 #include "qnstgraphicsnode.h"
6 
7 #include <cmath>
8 
9 #include <QGraphicsSceneMouseEvent>
10 
11 // Spring Algoritms Params
12 #define SPRING_LENGTH 125
13 #define SPRING_CONSTANT 0.1
14 #define SPRING_DAMPING 0.5
15 
16 #define SPRING_INTERATION 50
17 
19 {
20  Q_OBJECT
21 
22 public:
24 
26 
27  QString getColor() const;
28 
29  void setColor(QString color);
30 
31  void setCollapsed(bool collapsed);
32 
33  qreal getLastW();
34 
35  qreal getLastH();
36 
37  void setLastW(qreal lastW);
38 
39  void setLastH(qreal lastH);
40 
41  bool isCollapsed();
42 
43  void collapse();
44 
45  virtual void updateToolTip();
46 
47  virtual void setProperties(const QMap <QString, QString> &properties);
48 
49  virtual void getProperties(QMap<QString, QString> &properties);
50 
51 protected slots:
52  void adjustWithSpring();
53 
54 protected:
55  virtual void draw(QPainter* painter);
56 
57  virtual void delineate(QPainterPath* painter) const;
58 
59  virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
60 
61  virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
62 
63  virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
64 
65 private:
66  bool collapsed;
67 
68  QString color;
69 
70  qreal lastw;
71 
72  qreal lasth;
73 
74  QnstGraphicsNode* tmp;
75 };
76 
77 #endif // QNSTGRAPHICSCOMPOSITION_H