-
Notifications
You must be signed in to change notification settings - Fork 1
/
headergraphicsitem.h
58 lines (49 loc) · 1.65 KB
/
headergraphicsitem.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
/** \file headergraphicsitem.h
* \brief Contains a header graphics item class.
*/
#ifndef HEADERGRAPHICSITEM_H
#define HEADERGRAPHICSITEM_H
#include <QGraphicsItem>
#include <QGraphicsSimpleTextItem>
#include <QGraphicsLineItem>
namespace DJ {
namespace View {
/** A header graphics item containing the header texts.
*/
class HeaderGraphicsItem : 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 header graphics item for the given width.
* \param screenWidth How wide this item will be.
* \param parent The parent of this item.
*/
explicit HeaderGraphicsItem(double screenWidth, 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);
private:
QGraphicsSimpleTextItem *rankTextItem;
QGraphicsSimpleTextItem *nameTextItem;
QGraphicsSimpleTextItem *solvedTextItem;
QGraphicsSimpleTextItem *timeTextItem;
int screenWidth;
};
} // namespace View
} // namespace DJ
#endif // HEADERGRAPHICSITEM_H