This repository was archived by the owner on May 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask.h
61 lines (49 loc) · 1.44 KB
/
task.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
#ifndef TASK_H
#define TASK_H
#include <QGraphicsLineItem>
#include "node.h"
QT_BEGIN_NAMESPACE
class QGraphicsPolygonItem;
class QGraphicsLineItem;
class QGraphicsScene;
class QRectF;
class QGraphicsSceneMouseEvent;
class QPainterPath;
class Node;
QT_END_NAMESPACE
class Task : public QGraphicsLineItem
{
public:
enum TypeTask { TaskNormal, TaskFictive };
enum State {Normal, Aller, Retour, Fin};
State state() {return _state;}
void setState(State state) {_state = state;}
Task(TypeTask typeTask, Node *start, Node *end,
const QString &id, int weight,
QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
TypeTask typeTask() { return myTypeTask; }
Node *start() const { return startNode; }
Node *end() const { return endNode; }
QString &id() { return _id; }
int weight() { return _weight; }
void updatePosition();
QString slack() {return _slack;}
void setSlack(const QString slack) {_slack = slack;}
bool critique() {return isCritique;}
void setCritique(bool critique) {isCritique = critique;}
protected:
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
private:
TypeTask myTypeTask;
QString _id;
int _weight;
Node *startNode;
Node *endNode;
QPolygonF arrowHead;
State _state;
QString _slack;
bool isCritique;
};
#endif // TASK_H