@@ -1,127 +1,127 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "qlegendmarker.h" |
|
22 | 22 | #include "qlegendmarker_p.h" |
|
23 | 23 | #include "legendmarkeritem_p.h" |
|
24 | 24 | #include "qlegend.h" |
|
25 | 25 | #include "qlegend_p.h" |
|
26 | 26 | #include "legendlayout_p.h" |
|
27 | 27 | #include <QFontMetrics> |
|
28 | 28 | #include <QGraphicsSceneEvent> |
|
29 | 29 | #include <QAbstractSeries> |
|
30 | 30 | |
|
31 | 31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | 32 | |
|
33 | 33 | QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) : |
|
34 | 34 | QObject(parent), |
|
35 | 35 | d_ptr(&d) |
|
36 | 36 | { |
|
37 | 37 | d_ptr->m_item->setVisible(d_ptr->series()->isVisible()); |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | QLegendMarker::~QLegendMarker() |
|
41 | 41 | { |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | QString QLegendMarker::label() const |
|
45 | 45 | { |
|
46 | 46 | return d_ptr->m_item->label(); |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | void QLegendMarker::setLabel(const QString &label) |
|
50 | 50 | { |
|
51 | 51 | d_ptr->m_item->setLabel(label); |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 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 | 59 | void QLegendMarker::setLabelBrush(const QBrush &brush) |
|
60 | 60 | { |
|
61 | 61 | d_ptr->m_item->setLabelBrush(brush); |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | QFont QLegendMarker::font() const |
|
65 | 65 | { |
|
66 | 66 | return d_ptr->m_item->font(); |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | void QLegendMarker::setFont(const QFont &font) |
|
70 | 70 | { |
|
71 | 71 | d_ptr->m_item->setFont(font); |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | QPen QLegendMarker::pen() const |
|
75 | 75 | { |
|
76 | 76 | return d_ptr->m_item->pen(); |
|
77 | 77 | } |
|
78 | 78 | |
|
79 | 79 | void QLegendMarker::setPen(const QPen &pen) |
|
80 | 80 | { |
|
81 | 81 | d_ptr->m_item->setPen(pen); |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | QBrush QLegendMarker::brush() const |
|
85 | 85 | { |
|
86 | 86 | return d_ptr->m_item->brush(); |
|
87 | 87 | } |
|
88 | 88 | |
|
89 | 89 | void QLegendMarker::setBrush(const QBrush &brush) |
|
90 | 90 | { |
|
91 | 91 | d_ptr->m_item->setBrush(brush); |
|
92 | 92 | } |
|
93 | 93 | |
|
94 | 94 | bool QLegendMarker::isVisible() const |
|
95 | 95 | { |
|
96 | 96 | return d_ptr->m_item->isVisible(); |
|
97 | 97 | } |
|
98 | 98 | |
|
99 | 99 | void QLegendMarker::setVisible(bool visible) |
|
100 | 100 | { |
|
101 | 101 | d_ptr->m_item->setVisible(visible); |
|
102 | 102 | } |
|
103 | 103 | |
|
104 | 104 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
105 | 105 | QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) : |
|
106 | 106 | q_ptr(q), |
|
107 | 107 | m_legend(legend) |
|
108 | 108 | { |
|
109 | 109 | m_item = new LegendMarkerItem(this); |
|
110 | 110 | // m_item->setVisible(q->series()->isVisible()); |
|
111 | 111 | } |
|
112 | 112 | |
|
113 | 113 | QLegendMarkerPrivate::~QLegendMarkerPrivate() |
|
114 | 114 | { |
|
115 | 115 | } |
|
116 | 116 | |
|
117 | 117 | void QLegendMarkerPrivate::invalidateLegend() |
|
118 | 118 | { |
|
119 | 119 | m_legend->d_ptr->m_layout->invalidate(); |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | |
|
124 | 124 | #include "moc_qlegendmarker.cpp" |
|
125 | 125 | #include "moc_qlegendmarker_p.cpp" |
|
126 | 126 | |
|
127 | 127 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now