forked from DOMjudge/DOMjura
-
Notifications
You must be signed in to change notification settings - Fork 0
/
winnergraphicsitem.h
60 lines (53 loc) · 1.6 KB
/
winnergraphicsitem.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
/** \file winnergraphicsitem.h
* \brief Contains a class for the winner item.
*/
#ifndef WINNERGRAPHICSITEM_H
#define WINNERGRAPHICSITEM_H
#include <QGraphicsItem>
#include <QGraphicsSimpleTextItem>
namespace DJ
{
namespace View
{
/** A winner graphics item.
*/
class WinnerGraphicsItem : public QObject, public QGraphicsItem
{
Q_OBJECT
/** The opacity of the item.
*/
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
Q_INTERFACES(QGraphicsItem)
public:
/** Constructs a new graphics item.
* \param parent The parent of this item.
*/
explicit WinnerGraphicsItem(QGraphicsItem *parent = 0);
/** 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 winner text to display.
* \param text The text to display.
*/
void setWinner(QString text);
/** Sets the contest name to display.
* \param text The contest name to display.
*/
void setContestName(QString text);
private:
void reAddItems();
QList<QGraphicsSimpleTextItem *> textItems;
QString winner;
QString contestName;
};
} // namespace View
} // namespace DJ
#endif // WINNERGRAPHICSITEM_H