@@ -1,127 +1,127 | |||||
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 "qlegendmarker.h" |
|
21 | #include "qlegendmarker.h" | |
22 | #include "qlegendmarker_p.h" |
|
22 | #include "qlegendmarker_p.h" | |
23 | #include "legendmarkeritem_p.h" |
|
23 | #include "legendmarkeritem_p.h" | |
24 | #include "qlegend.h" |
|
24 | #include "qlegend.h" | |
25 | #include "qlegend_p.h" |
|
25 | #include "qlegend_p.h" | |
26 | #include "legendlayout_p.h" |
|
26 | #include "legendlayout_p.h" | |
27 | #include <QFontMetrics> |
|
27 | #include <QFontMetrics> | |
28 | #include <QGraphicsSceneEvent> |
|
28 | #include <QGraphicsSceneEvent> | |
29 | #include <QAbstractSeries> |
|
29 | #include <QAbstractSeries> | |
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) : |
|
33 | QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) : | |
34 | QObject(parent), |
|
34 | QObject(parent), | |
35 | d_ptr(&d) |
|
35 | d_ptr(&d) | |
36 | { |
|
36 | { | |
37 | d_ptr->m_item->setVisible(d_ptr->series()->isVisible()); |
|
37 | d_ptr->m_item->setVisible(d_ptr->series()->isVisible()); | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | QLegendMarker::~QLegendMarker() |
|
40 | QLegendMarker::~QLegendMarker() | |
41 | { |
|
41 | { | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | QString QLegendMarker::label() const |
|
44 | QString QLegendMarker::label() const | |
45 | { |
|
45 | { | |
46 | return d_ptr->m_item->label(); |
|
46 | return d_ptr->m_item->label(); | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | void QLegendMarker::setLabel(const QString &label) |
|
49 | void QLegendMarker::setLabel(const QString &label) | |
50 | { |
|
50 | { | |
51 | d_ptr->m_item->setLabel(label); |
|
51 | d_ptr->m_item->setLabel(label); | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | QBrush QLegendMarker::labelBrush() const |
|
54 | QBrush QLegendMarker::labelBrush() const | |
55 | { |
|
55 | { | |
56 | return d_ptr->m_item->brush(); |
|
56 | return d_ptr->m_item->labelBrush(); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | void QLegendMarker::setLabelBrush(const QBrush &brush) |
|
59 | void QLegendMarker::setLabelBrush(const QBrush &brush) | |
60 | { |
|
60 | { | |
61 | d_ptr->m_item->setLabelBrush(brush); |
|
61 | d_ptr->m_item->setLabelBrush(brush); | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | QFont QLegendMarker::font() const |
|
64 | QFont QLegendMarker::font() const | |
65 | { |
|
65 | { | |
66 | return d_ptr->m_item->font(); |
|
66 | return d_ptr->m_item->font(); | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void QLegendMarker::setFont(const QFont &font) |
|
69 | void QLegendMarker::setFont(const QFont &font) | |
70 | { |
|
70 | { | |
71 | d_ptr->m_item->setFont(font); |
|
71 | d_ptr->m_item->setFont(font); | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | QPen QLegendMarker::pen() const |
|
74 | QPen QLegendMarker::pen() const | |
75 | { |
|
75 | { | |
76 | return d_ptr->m_item->pen(); |
|
76 | return d_ptr->m_item->pen(); | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | void QLegendMarker::setPen(const QPen &pen) |
|
79 | void QLegendMarker::setPen(const QPen &pen) | |
80 | { |
|
80 | { | |
81 | d_ptr->m_item->setPen(pen); |
|
81 | d_ptr->m_item->setPen(pen); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | QBrush QLegendMarker::brush() const |
|
84 | QBrush QLegendMarker::brush() const | |
85 | { |
|
85 | { | |
86 | return d_ptr->m_item->brush(); |
|
86 | return d_ptr->m_item->brush(); | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | void QLegendMarker::setBrush(const QBrush &brush) |
|
89 | void QLegendMarker::setBrush(const QBrush &brush) | |
90 | { |
|
90 | { | |
91 | d_ptr->m_item->setBrush(brush); |
|
91 | d_ptr->m_item->setBrush(brush); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | bool QLegendMarker::isVisible() const |
|
94 | bool QLegendMarker::isVisible() const | |
95 | { |
|
95 | { | |
96 | return d_ptr->m_item->isVisible(); |
|
96 | return d_ptr->m_item->isVisible(); | |
97 | } |
|
97 | } | |
98 |
|
98 | |||
99 | void QLegendMarker::setVisible(bool visible) |
|
99 | void QLegendMarker::setVisible(bool visible) | |
100 | { |
|
100 | { | |
101 | d_ptr->m_item->setVisible(visible); |
|
101 | d_ptr->m_item->setVisible(visible); | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
104 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
105 | QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) : |
|
105 | QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) : | |
106 | q_ptr(q), |
|
106 | q_ptr(q), | |
107 | m_legend(legend) |
|
107 | m_legend(legend) | |
108 | { |
|
108 | { | |
109 | m_item = new LegendMarkerItem(this); |
|
109 | m_item = new LegendMarkerItem(this); | |
110 | // m_item->setVisible(q->series()->isVisible()); |
|
110 | // m_item->setVisible(q->series()->isVisible()); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | QLegendMarkerPrivate::~QLegendMarkerPrivate() |
|
113 | QLegendMarkerPrivate::~QLegendMarkerPrivate() | |
114 | { |
|
114 | { | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | void QLegendMarkerPrivate::invalidateLegend() |
|
117 | void QLegendMarkerPrivate::invalidateLegend() | |
118 | { |
|
118 | { | |
119 | m_legend->d_ptr->m_layout->invalidate(); |
|
119 | m_legend->d_ptr->m_layout->invalidate(); | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 |
|
122 | |||
123 |
|
123 | |||
124 | #include "moc_qlegendmarker.cpp" |
|
124 | #include "moc_qlegendmarker.cpp" | |
125 | #include "moc_qlegendmarker_p.cpp" |
|
125 | #include "moc_qlegendmarker_p.cpp" | |
126 |
|
126 | |||
127 | QTCOMMERCIALCHART_END_NAMESPACE |
|
127 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now