@@ -0,0 +1,61 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
|
30 | #ifndef QPIELEGENDMARKER_P_H | |||
|
31 | #define QPIELEGENDMARKER_P_H | |||
|
32 | ||||
|
33 | #include "qchartglobal.h" | |||
|
34 | #include "qlegendmarker_p.h" | |||
|
35 | #include "legendmarkeritem_p.h" | |||
|
36 | ||||
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
38 | ||||
|
39 | class QPieLegendMarker; | |||
|
40 | ||||
|
41 | class QPieLegendMarkerPrivate : public QLegendMarkerPrivate | |||
|
42 | { | |||
|
43 | Q_OBJECT | |||
|
44 | public: | |||
|
45 | explicit QPieLegendMarkerPrivate(QAbstractSeries *series, QPieLegendMarker *q); | |||
|
46 | virtual ~QPieLegendMarkerPrivate(); | |||
|
47 | ||||
|
48 | public Q_SLOTS: | |||
|
49 | virtual void updated() {}; | |||
|
50 | ||||
|
51 | private: | |||
|
52 | QPieLegendMarker *q_ptr; | |||
|
53 | PieLegendMarkerItem *m_item; | |||
|
54 | ||||
|
55 | friend class QLegendPrivate; // TODO: Is this needed? | |||
|
56 | Q_DECLARE_PUBLIC(QPieLegendMarker) | |||
|
57 | }; | |||
|
58 | ||||
|
59 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
60 | ||||
|
61 | #endif // QPIELEGENDMARKER_P_H |
@@ -1,24 +1,25 | |||||
1 | INCLUDEPATH += $$PWD |
|
1 | INCLUDEPATH += $$PWD | |
2 | DEPENDPATH += $$PWD |
|
2 | DEPENDPATH += $$PWD | |
3 |
|
3 | |||
4 | SOURCES += \ |
|
4 | SOURCES += \ | |
5 | $$PWD/qlegend.cpp \ |
|
5 | $$PWD/qlegend.cpp \ | |
6 | $$PWD/legendmarker.cpp \ |
|
6 | $$PWD/legendmarker.cpp \ | |
7 | $$PWD/legendlayout.cpp \ |
|
7 | $$PWD/legendlayout.cpp \ | |
8 | $$PWD/qlegendmarker.cpp \ |
|
8 | $$PWD/qlegendmarker.cpp \ | |
9 | $$PWD/qpielegendmarker.cpp \ |
|
9 | $$PWD/qpielegendmarker.cpp \ | |
10 | $$PWD/legendmarkeritem.cpp |
|
10 | $$PWD/legendmarkeritem.cpp | |
11 |
|
11 | |||
12 | PRIVATE_HEADERS += \ |
|
12 | PRIVATE_HEADERS += \ | |
13 | $$PWD/legendmarker_p.h \ |
|
13 | $$PWD/legendmarker_p.h \ | |
14 | $$PWD/legendscroller_p.h \ |
|
14 | $$PWD/legendscroller_p.h \ | |
15 | $$PWD/qlegend_p.h \ |
|
15 | $$PWD/qlegend_p.h \ | |
16 | $$PWD/legendlayout_p.h \ |
|
16 | $$PWD/legendlayout_p.h \ | |
17 | $$PWD/qlegendmarker_p.h \ |
|
17 | $$PWD/qlegendmarker_p.h \ | |
18 | $$PWD/legendmarkeritem_p.h |
|
18 | $$PWD/legendmarkeritem_p.h \ | |
|
19 | $$PWD/qpielegendmarker_p.h | |||
19 |
|
20 | |||
20 |
|
21 | |||
21 | PUBLIC_HEADERS += \ |
|
22 | PUBLIC_HEADERS += \ | |
22 | $$PWD/qlegend.h \ |
|
23 | $$PWD/qlegend.h \ | |
23 | $$PWD/qlegendmarker.h \ |
|
24 | $$PWD/qlegendmarker.h \ | |
24 | $$PWD/qpielegendmarker.h |
|
25 | $$PWD/qpielegendmarker.h |
@@ -1,116 +1,121 | |||||
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 <QDebug> |
|
24 | #include <QDebug> | |
25 | #include <QFontMetrics> |
|
25 | #include <QFontMetrics> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | QLegendMarker::QLegendMarker(QAbstractSeries* series, QObject *parent) : |
|
29 | QLegendMarker::QLegendMarker(QAbstractSeries* series, QObject *parent) : | |
30 | QObject(parent), |
|
30 | QObject(parent), | |
31 | d_ptr(new QLegendMarkerPrivate(series, this)) |
|
31 | d_ptr(new QLegendMarkerPrivate(series, this)) | |
32 | { |
|
32 | { | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | QLegendMarker::~QLegendMarker() |
|
35 | QLegendMarker::~QLegendMarker() | |
36 | { |
|
36 | { | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | QString QLegendMarker::label() const |
|
39 | QString QLegendMarker::label() const | |
40 | { |
|
40 | { | |
41 | return d_ptr->m_label; |
|
41 | return d_ptr->m_label; | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | void QLegendMarker::setLabel(const QString &label) |
|
44 | void QLegendMarker::setLabel(const QString &label) | |
45 | { |
|
45 | { | |
46 | d_ptr->m_label = label; |
|
46 | d_ptr->m_label = label; | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | QBrush QLegendMarker::labelBrush() const |
|
49 | QBrush QLegendMarker::labelBrush() const | |
50 | { |
|
50 | { | |
51 | return d_ptr->m_labelBrush; |
|
51 | return d_ptr->m_labelBrush; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | void QLegendMarker::setLabelBrush(const QBrush &brush) |
|
54 | void QLegendMarker::setLabelBrush(const QBrush &brush) | |
55 | { |
|
55 | { | |
56 | d_ptr->m_labelBrush = brush; |
|
56 | d_ptr->m_labelBrush = brush; | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | QFont QLegendMarker::font() const |
|
59 | QFont QLegendMarker::font() const | |
60 | { |
|
60 | { | |
61 | return d_ptr->m_font; |
|
61 | return d_ptr->m_font; | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | void QLegendMarker::setFont(const QFont &font) |
|
64 | void QLegendMarker::setFont(const QFont &font) | |
65 | { |
|
65 | { | |
66 | d_ptr->m_font = font; |
|
66 | d_ptr->m_font = font; | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | QPen QLegendMarker::pen() const |
|
69 | QPen QLegendMarker::pen() const | |
70 | { |
|
70 | { | |
71 | return d_ptr->m_pen; |
|
71 | return d_ptr->m_pen; | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | void QLegendMarker::setPen(const QPen &pen) |
|
74 | void QLegendMarker::setPen(const QPen &pen) | |
75 | { |
|
75 | { | |
76 | d_ptr->m_pen = pen; |
|
76 | d_ptr->m_pen = pen; | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | QBrush QLegendMarker::brush() const |
|
79 | QBrush QLegendMarker::brush() const | |
80 | { |
|
80 | { | |
81 | return d_ptr->m_brush; |
|
81 | return d_ptr->m_brush; | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | void QLegendMarker::setBrush(const QBrush &brush) |
|
84 | void QLegendMarker::setBrush(const QBrush &brush) | |
85 | { |
|
85 | { | |
86 | d_ptr->m_brush = brush; |
|
86 | d_ptr->m_brush = brush; | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | bool QLegendMarker::isVisible() const |
|
89 | bool QLegendMarker::isVisible() const | |
90 | { |
|
90 | { | |
91 | return d_ptr->m_visible; |
|
91 | return d_ptr->m_visible; | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | void QLegendMarker::setVisible(bool visible) |
|
94 | void QLegendMarker::setVisible(bool visible) | |
95 | { |
|
95 | { | |
96 | d_ptr->m_visible = visible; |
|
96 | d_ptr->m_visible = visible; | |
97 | } |
|
97 | } | |
98 |
|
98 | |||
99 | QAbstractSeries* QLegendMarker::series() |
|
99 | QAbstractSeries* QLegendMarker::series() | |
100 | { |
|
100 | { | |
101 | return d_ptr->m_series; |
|
101 | return d_ptr->m_series; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
104 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
105 |
|
105 | |||
106 | QLegendMarkerPrivate::QLegendMarkerPrivate(QAbstractSeries *series, QLegendMarker *q) : |
|
106 | QLegendMarkerPrivate::QLegendMarkerPrivate(QAbstractSeries *series, QLegendMarker *q) : | |
107 | q_ptr(q), |
|
107 | q_ptr(q), | |
108 | m_series(series) |
|
108 | m_series(series) | |
109 | { |
|
109 | { | |
110 | m_item = new LegendMarkerItem(m_series); |
|
110 | m_item = new LegendMarkerItem(m_series); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
|
113 | QLegendMarkerPrivate::~QLegendMarkerPrivate() | |||
|
114 | { | |||
|
115 | } | |||
|
116 | ||||
|
117 | ||||
113 | #include "moc_qlegendmarker.cpp" |
|
118 | #include "moc_qlegendmarker.cpp" | |
114 | #include "moc_qlegendmarker_p.cpp" |
|
119 | #include "moc_qlegendmarker_p.cpp" | |
115 |
|
120 | |||
116 | QTCOMMERCIALCHART_END_NAMESPACE |
|
121 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,112 +1,113 | |||||
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 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef QLEGENDMARKERPRIVATE_H |
|
30 | #ifndef QLEGENDMARKERPRIVATE_H | |
31 | #define QLEGENDMARKERPRIVATE_H |
|
31 | #define QLEGENDMARKERPRIVATE_H | |
32 |
|
32 | |||
33 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
34 | #include <QGraphicsObject> |
|
34 | #include <QGraphicsObject> | |
35 | #include <QBrush> |
|
35 | #include <QBrush> | |
36 | #include <QPen> |
|
36 | #include <QPen> | |
37 | #include <QGraphicsSimpleTextItem> |
|
37 | #include <QGraphicsSimpleTextItem> | |
38 | #include <QGraphicsLayoutItem> |
|
38 | #include <QGraphicsLayoutItem> | |
39 |
|
39 | |||
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
41 |
|
41 | |||
42 | // TODO: check these |
|
42 | // TODO: check these | |
43 | class QAbstractSeries; |
|
43 | class QAbstractSeries; | |
44 | class QAreaSeries; |
|
44 | class QAreaSeries; | |
45 | class QXYSeries; |
|
45 | class QXYSeries; | |
46 | class QBarSet; |
|
46 | class QBarSet; | |
47 | class QAbstractBarSeries; |
|
47 | class QAbstractBarSeries; | |
48 | class QPieSlice; |
|
48 | class QPieSlice; | |
49 | class QLegend; |
|
49 | class QLegend; | |
50 | class QPieSeries; |
|
50 | class QPieSeries; | |
51 |
|
51 | |||
52 | class QLegendMarker; |
|
52 | class QLegendMarker; | |
53 | class LegendMarkerItem; |
|
53 | class LegendMarkerItem; | |
54 |
|
54 | |||
55 | class QLegendMarkerPrivate : public QObject |
|
55 | class QLegendMarkerPrivate : public QObject | |
56 | { |
|
56 | { | |
57 | Q_OBJECT |
|
57 | Q_OBJECT | |
58 | public: |
|
58 | public: | |
59 | explicit QLegendMarkerPrivate(QAbstractSeries *series, QLegendMarker *q); |
|
59 | explicit QLegendMarkerPrivate(QAbstractSeries *series, QLegendMarker *q); | |
|
60 | virtual ~QLegendMarkerPrivate(); | |||
60 | /* |
|
61 | /* | |
61 | void setPen(const QPen &pen); |
|
62 | void setPen(const QPen &pen); | |
62 | QPen pen() const; |
|
63 | QPen pen() const; | |
63 |
|
64 | |||
64 | void setBrush(const QBrush &brush); |
|
65 | void setBrush(const QBrush &brush); | |
65 | QBrush brush() const; |
|
66 | QBrush brush() const; | |
66 |
|
67 | |||
67 | void setFont(const QFont &font); |
|
68 | void setFont(const QFont &font); | |
68 | QFont font() const; |
|
69 | QFont font() const; | |
69 |
|
70 | |||
70 | void setLabel(const QString label); |
|
71 | void setLabel(const QString label); | |
71 | QString label() const; |
|
72 | QString label() const; | |
72 |
|
73 | |||
73 | void setLabelBrush(const QBrush &brush); |
|
74 | void setLabelBrush(const QBrush &brush); | |
74 | QBrush labelBrush() const; |
|
75 | QBrush labelBrush() const; | |
75 | */ |
|
76 | */ | |
76 |
|
77 | |||
77 | public Q_SLOTS: |
|
78 | public Q_SLOTS: | |
78 | virtual void updated() {}; |
|
79 | virtual void updated() {}; | |
79 |
|
80 | |||
80 | private: |
|
81 | private: | |
81 | QLegendMarker *q_ptr; |
|
82 | QLegendMarker *q_ptr; | |
82 |
|
83 | |||
83 | LegendMarkerItem *m_item; |
|
84 | LegendMarkerItem *m_item; | |
84 |
|
85 | |||
85 | /* |
|
86 | /* | |
86 | QLegend* m_legend; |
|
87 | QLegend* m_legend; | |
87 | */ |
|
88 | */ | |
88 |
|
89 | |||
89 | // New legend marker properties |
|
90 | // New legend marker properties | |
90 | QAbstractSeries* m_series; |
|
91 | QAbstractSeries* m_series; | |
91 | QString m_label; |
|
92 | QString m_label; | |
92 | QBrush m_labelBrush; |
|
93 | QBrush m_labelBrush; | |
93 | QFont m_font; |
|
94 | QFont m_font; | |
94 | QPen m_pen; |
|
95 | QPen m_pen; | |
95 | QBrush m_brush; |
|
96 | QBrush m_brush; | |
96 | bool m_visible; |
|
97 | bool m_visible; | |
97 |
|
98 | |||
98 | // Implementation details of new marker |
|
99 | // Implementation details of new marker | |
99 | QRectF m_markerRect; |
|
100 | QRectF m_markerRect; | |
100 | QRectF m_boundingRect; |
|
101 | QRectF m_boundingRect; | |
101 | QGraphicsSimpleTextItem *m_textItem; |
|
102 | QGraphicsSimpleTextItem *m_textItem; | |
102 | QGraphicsRectItem *m_rectItem; |
|
103 | QGraphicsRectItem *m_rectItem; | |
103 | qreal m_margin; |
|
104 | qreal m_margin; | |
104 | qreal m_space; |
|
105 | qreal m_space; | |
105 |
|
106 | |||
106 | friend class QLegendPrivate; // TODO: Is this needed? |
|
107 | friend class QLegendPrivate; // TODO: Is this needed? | |
107 | Q_DECLARE_PUBLIC(QLegendMarker) |
|
108 | Q_DECLARE_PUBLIC(QLegendMarker) | |
108 | }; |
|
109 | }; | |
109 |
|
110 | |||
110 | QTCOMMERCIALCHART_END_NAMESPACE |
|
111 | QTCOMMERCIALCHART_END_NAMESPACE | |
111 |
|
112 | |||
112 | #endif // QLEGENDMARKERPRIVATE_H |
|
113 | #endif // QLEGENDMARKERPRIVATE_H |
@@ -1,50 +1,62 | |||||
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 "qpielegendmarker.h" |
|
21 | #include "qpielegendmarker.h" | |
|
22 | #include "qpielegendmarker_p.h" | |||
22 | #include <QPieSeries> |
|
23 | #include <QPieSeries> | |
23 |
|
24 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
26 | |||
26 | QPieLegendMarker::QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject *parent) : |
|
27 | QPieLegendMarker::QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject *parent) : | |
27 | QLegendMarker(series, parent), |
|
28 | QLegendMarker(series, parent), | |
28 | m_slice(slice) |
|
29 | m_slice(slice) | |
29 | { |
|
30 | { | |
30 | QObject::connect(slice, SIGNAL(labelChanged()), this, SLOT(updated())); |
|
31 | QObject::connect(slice, SIGNAL(labelChanged()), this, SLOT(updated())); | |
31 | QObject::connect(slice, SIGNAL(brushChanged()), this, SLOT(updated())); |
|
32 | QObject::connect(slice, SIGNAL(brushChanged()), this, SLOT(updated())); | |
32 | updated(); |
|
33 | updated(); | |
33 | } |
|
34 | } | |
34 |
|
35 | |||
35 | QPieSlice* QPieLegendMarker::peerObject() |
|
36 | QPieSlice* QPieLegendMarker::peerObject() | |
36 | { |
|
37 | { | |
37 | return m_slice; |
|
38 | return m_slice; | |
38 | } |
|
39 | } | |
39 |
|
40 | |||
40 | void QPieLegendMarker::updated() |
|
41 | void QPieLegendMarker::updated() | |
41 | { |
|
42 | { | |
42 | // TODO: to PIMPL. |
|
43 | // TODO: to PIMPL. | |
43 | setBrush(m_slice->brush()); |
|
44 | setBrush(m_slice->brush()); | |
44 | setLabel(m_slice->label()); |
|
45 | setLabel(m_slice->label()); | |
45 | } |
|
46 | } | |
46 |
|
47 | |||
|
48 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
|
49 | ||||
|
50 | QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QAbstractSeries *series, QPieLegendMarker *q) : | |||
|
51 | QLegendMarkerPrivate(series, q) | |||
|
52 | { | |||
|
53 | } | |||
|
54 | ||||
|
55 | QPieLegendMarkerPrivate::~QPieLegendMarkerPrivate() | |||
|
56 | { | |||
|
57 | } | |||
|
58 | ||||
47 | #include "moc_qpielegendmarker.cpp" |
|
59 | #include "moc_qpielegendmarker.cpp" | |
48 |
|
|
60 | #include "moc_qpielegendmarker_p.cpp" | |
49 |
|
61 | |||
50 | QTCOMMERCIALCHART_END_NAMESPACE |
|
62 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,57 +1,57 | |||||
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 | #ifndef QPIELEGENDMARKER_H |
|
21 | #ifndef QPIELEGENDMARKER_H | |
22 | #define QPIELEGENDMARKER_H |
|
22 | #define QPIELEGENDMARKER_H | |
23 |
|
23 | |||
24 | #include <QChartGlobal> |
|
24 | #include <QChartGlobal> | |
25 | #include <QLegendMarker> |
|
25 | #include <QLegendMarker> | |
26 | #include <QPieSlice> |
|
26 | #include <QPieSlice> | |
|
27 | #include "qpielegendmarker_p.h" | |||
27 |
|
28 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
30 | |||
30 | class QTCOMMERCIALCHART_EXPORT QPieLegendMarker : public QLegendMarker |
|
31 | class QTCOMMERCIALCHART_EXPORT QPieLegendMarker : public QLegendMarker | |
31 | { |
|
32 | { | |
32 | Q_OBJECT |
|
33 | Q_OBJECT | |
33 |
|
34 | |||
34 | public: |
|
35 | public: | |
35 | explicit QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject *parent = 0); |
|
36 | explicit QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject *parent = 0); | |
36 |
|
37 | |||
37 | virtual QPieSlice* peerObject(); |
|
38 | virtual QPieSlice* peerObject(); | |
38 |
|
39 | |||
39 | // TODO: to pimpl. |
|
40 | // TODO: to pimpl. | |
40 | void updated(); |
|
41 | void updated(); | |
41 |
|
42 | |||
42 | //Q_SIGNALS: |
|
43 | //Q_SIGNALS: | |
43 |
|
44 | |||
44 | //public Q_SLOTS: |
|
45 | //public Q_SLOTS: | |
45 |
|
46 | |||
46 | private: |
|
47 | private: | |
47 | // TODO: |
|
48 | QScopedPointer<QPieLegendMarkerPrivate> d_ptr; | |
48 | // QScopedPointer<QPieLegendMarkerPrivate> d_ptr; |
|
|||
49 | Q_DISABLE_COPY(QPieLegendMarker) |
|
49 | Q_DISABLE_COPY(QPieLegendMarker) | |
50 |
|
50 | |||
51 | // TODO: PIMPL |
|
51 | // TODO: PIMPL | |
52 | QPieSlice* m_slice; |
|
52 | QPieSlice* m_slice; | |
53 |
|
53 | |||
54 | }; |
|
54 | }; | |
55 |
|
55 | |||
56 | QTCOMMERCIALCHART_END_NAMESPACE |
|
56 | QTCOMMERCIALCHART_END_NAMESPACE | |
57 | #endif // QPIELEGENDMARKER_H |
|
57 | #endif // QPIELEGENDMARKER_H |
General Comments 0
You need to be logged in to leave comments.
Login now