@@ -1,88 +1,89 | |||||
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 "barvalue_p.h" |
|
21 | #include "barvalue_p.h" | |
22 | #include <QPainter> |
|
22 | #include <QPainter> | |
23 | #include <QPen> |
|
23 | #include <QPen> | |
24 | #include <QGraphicsSimpleTextItem> |
|
24 | #include <QGraphicsSimpleTextItem> | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | BarValue::BarValue(QBarSet &set, QGraphicsItem *parent) : QGraphicsObject(parent), |
|
28 | BarValue::BarValue(QBarSet &set, QGraphicsItem *parent) : QGraphicsObject(parent), | |
29 | m_barSet(set), |
|
29 | m_barSet(set), | |
30 | m_textItem(new QGraphicsSimpleTextItem(this)) |
|
30 | m_textItem(new QGraphicsSimpleTextItem(this)) | |
31 | { |
|
31 | { | |
32 | // connect(&set,SIGNAL(valuesVisibleChanged(bool)),value,SLOT(valuesVisibleChanged(bool))); |
|
32 | // connect(&set,SIGNAL(valuesVisibleChanged(bool)),value,SLOT(valuesVisibleChanged(bool))); | |
33 | setVisible(false); |
|
33 | setVisible(false); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | void BarValue::setText(QString str) |
|
36 | void BarValue::setText(QString str) | |
37 | { |
|
37 | { | |
38 | m_textItem->setText(str); |
|
38 | m_textItem->setText(str); | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | QString BarValue::text() const |
|
41 | QString BarValue::text() const | |
42 | { |
|
42 | { | |
43 | return m_textItem->text(); |
|
43 | return m_textItem->text(); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | void BarValue::setPen(const QPen &pen) |
|
46 | void BarValue::setPen(const QPen &pen) | |
47 | { |
|
47 | { | |
48 | m_textItem->setPen(pen); |
|
48 | m_textItem->setPen(pen); | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | QPen BarValue::pen() const |
|
51 | QPen BarValue::pen() const | |
52 | { |
|
52 | { | |
53 | return m_textItem->pen(); |
|
53 | return m_textItem->pen(); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | void BarValue::setFont(const QFont &font) |
|
56 | void BarValue::setFont(const QFont &font) | |
57 | { |
|
57 | { | |
58 | m_textItem->setFont(font); |
|
58 | m_textItem->setFont(font); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | QFont BarValue::font() const |
|
61 | QFont BarValue::font() const | |
62 | { |
|
62 | { | |
63 | return m_textItem->font(); |
|
63 | return m_textItem->font(); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | void BarValue::setPos(qreal x, qreal y) |
|
66 | void BarValue::setPos(qreal x, qreal y) | |
67 | { |
|
67 | { | |
68 | m_textItem->setPos(x,y); |
|
68 | m_textItem->setPos(x,y); | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
71 | void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
72 | { |
|
72 | { | |
|
73 | Q_UNUSED(painter) | |||
73 | Q_UNUSED(option) |
|
74 | Q_UNUSED(option) | |
74 | Q_UNUSED(widget) |
|
75 | Q_UNUSED(widget) | |
75 | } |
|
76 | } | |
76 |
|
77 | |||
77 | QRectF BarValue::boundingRect() const |
|
78 | QRectF BarValue::boundingRect() const | |
78 | { |
|
79 | { | |
79 | return m_textItem->boundingRect(); |
|
80 | return m_textItem->boundingRect(); | |
80 | } |
|
81 | } | |
81 |
|
82 | |||
82 | void BarValue::valuesVisibleChanged(bool visible) |
|
83 | void BarValue::valuesVisibleChanged(bool visible) | |
83 | { |
|
84 | { | |
84 | setVisible(visible); |
|
85 | setVisible(visible); | |
85 | } |
|
86 | } | |
86 |
|
87 | |||
87 | #include "moc_barvalue_p.cpp" |
|
88 | #include "moc_barvalue_p.cpp" | |
88 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now