-
Notifications
You must be signed in to change notification settings - Fork 1
/
teamgraphicsitem.h
95 lines (85 loc) · 2.76 KB
/
teamgraphicsitem.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/** \file teamgraphicsitem.h
* \brief Contains the class for a team item.
*/
#ifndef TEAMGRAPHICSITEM_H
#define TEAMGRAPHICSITEM_H
#include <QGraphicsItem>
#include <QGraphicsSimpleTextItem>
#include "problemgraphicsitem.h"
namespace DJ {
namespace View {
/** A team graphics item.
*/
class TeamGraphicsItem : public QObject, public QGraphicsItem {
Q_OBJECT
/** The position of this item.
*/
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
/** The opacity of this item.
*/
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
Q_INTERFACES(QGraphicsItem)
public:
/** Constructs a new team item.
* \param problemItems The problem items for this team.
* \param parent The parent of this item.
*/
TeamGraphicsItem(QList<ProblemGraphicsItem *> problemItems, QGraphicsItem *parent = NULL);
/** Returns the bounding rectangle for this item.
* \return The bounding rectangle for this item.
*/
QRectF boundingRect() const;
/** Paints this item on the scene.
* \param painter The painter to use.
* \param option The current option information.
* \param widget The widget to draw on.
*/
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
/** Sets the rank of this team.
* \param rank The rank to set.
*/
void setRank(int rank);
/** Sets the name of this team.
* \param name The name to set.
*/
void setName(QString name);
/** Sets the solved state of this team.
* \param solved The solved stte to set.
*/
void setSolved(int solved);
/** Sets the total time of this team.
* \param time The total time to set.
*/
void setTime(int time);
/** Sets whether this row is even.
* \param even Whether this row is even or not.
*/
void setEven(bool even);
/** Sets whether this row is highlighted.
* \param even Whether this row is highlighted or not.
*/
void setHighlighted(bool highlighted);
/** Sets the medal of this team.
* \param medal The medal to set.
*/
void setMedal(Medal medal);
/** Returns the i-th problem item.
* \param i The index to use.
* \return The i-th problem item.
*/
ProblemGraphicsItem *getProblemGraphicsItem(int i);
private:
bool highlighted;
int screenWidth;
bool even;
Medal medal;
QGraphicsSimpleTextItem *rankItem;
QGraphicsSimpleTextItem *nameItem;
QGraphicsSimpleTextItem *solvedItem;
QGraphicsSimpleTextItem *timeItem;
QList<ProblemGraphicsItem *> problemItems;
};
} // namespace View
} // namespace DJ
#endif // TEAMGRAPHICSITEM_H