@@ -1,57 +1,58 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "bar_p.h" |
|
21 | #include "bar_p.h" | |
22 | #include <QDebug> |
|
22 | #include <QDebug> | |
23 | #include <QPainter> |
|
23 | #include <QPainter> | |
24 | #include <QGraphicsSceneEvent> |
|
24 | #include <QGraphicsSceneEvent> | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | Bar::Bar(QBarSet *barset, QString category, QGraphicsItem *parent) : QGraphicsRectItem(parent), |
|
28 | Bar::Bar(QBarSet *barset, QString category, QGraphicsItem *parent) : QGraphicsRectItem(parent), | |
29 | m_category(category), |
|
29 | m_category(category), | |
30 | m_barset(barset) |
|
30 | m_barset(barset) | |
31 | { |
|
31 | { | |
32 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); |
|
32 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); | |
33 | setAcceptHoverEvents(true); |
|
33 | setAcceptHoverEvents(true); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
36 | void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
37 | { |
|
37 | { | |
38 | emit clicked(m_category, event->button()); |
|
38 | emit clicked(m_category, event->button()); | |
39 | emit clicked(m_barset, m_category, event->button()); |
|
39 | emit clicked(m_barset, m_category, event->button()); | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) |
|
42 | void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | |
43 | { |
|
43 | { | |
|
44 | Q_UNUSED(event) | |||
44 | emit hovered(true); |
|
45 | emit hovered(true); | |
45 | emit hovered(m_barset, true); |
|
46 | emit hovered(m_barset, true); | |
46 | } |
|
47 | } | |
47 |
|
48 | |||
48 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) |
|
49 | void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |
49 | { |
|
50 | { | |
50 | Q_UNUSED(event) |
|
51 | Q_UNUSED(event) | |
51 | emit hovered(false); |
|
52 | emit hovered(false); | |
52 | emit hovered(m_barset, false); |
|
53 | emit hovered(m_barset, false); | |
53 | } |
|
54 | } | |
54 |
|
55 | |||
55 | #include "moc_bar_p.cpp" |
|
56 | #include "moc_bar_p.cpp" | |
56 |
|
57 | |||
57 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now