@@ -0,0 +1,85 | |||||
|
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 | #include "qarealegendmarker.h" | |||
|
22 | #include "qarealegendmarker_p.h" | |||
|
23 | #include "qareaseries_p.h" | |||
|
24 | #include <QAreaSeries> | |||
|
25 | #include <QDebug> | |||
|
26 | ||||
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
28 | ||||
|
29 | QAreaLegendMarker::QAreaLegendMarker(QAreaSeries* series, QLegend *legend, QObject *parent) : | |||
|
30 | QLegendMarker(*new QAreaLegendMarkerPrivate(this,series,legend), parent) | |||
|
31 | { | |||
|
32 | } | |||
|
33 | ||||
|
34 | QAreaLegendMarker::~QAreaLegendMarker() | |||
|
35 | { | |||
|
36 | // qDebug() << "deleting Area marker" << this; | |||
|
37 | } | |||
|
38 | ||||
|
39 | /*! | |||
|
40 | \internal | |||
|
41 | */ | |||
|
42 | QAreaLegendMarker::QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent) : | |||
|
43 | QLegendMarker(d, parent) | |||
|
44 | { | |||
|
45 | } | |||
|
46 | ||||
|
47 | QAreaSeries* QAreaLegendMarker::series() | |||
|
48 | { | |||
|
49 | Q_D(QAreaLegendMarker); | |||
|
50 | return d->m_series; | |||
|
51 | } | |||
|
52 | ||||
|
53 | QAreaSeries* QAreaLegendMarker::peerObject() | |||
|
54 | { | |||
|
55 | Q_D(QAreaLegendMarker); | |||
|
56 | return d->m_series; | |||
|
57 | } | |||
|
58 | ||||
|
59 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
|
60 | ||||
|
61 | QAreaLegendMarkerPrivate::QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend) : | |||
|
62 | QLegendMarkerPrivate(q,legend), | |||
|
63 | m_series(series) | |||
|
64 | { | |||
|
65 | QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(updated())); | |||
|
66 | QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated())); | |||
|
67 | updated(); | |||
|
68 | } | |||
|
69 | ||||
|
70 | QAreaLegendMarkerPrivate::~QAreaLegendMarkerPrivate() | |||
|
71 | { | |||
|
72 | QObject::disconnect(m_series->d_func(),SIGNAL(updated()), this, SLOT(updated())); | |||
|
73 | QObject::disconnect(m_series, SIGNAL(nameChanged()), this, SLOT(updated())); | |||
|
74 | } | |||
|
75 | ||||
|
76 | void QAreaLegendMarkerPrivate::updated() | |||
|
77 | { | |||
|
78 | m_item->setBrush(m_series->brush()); | |||
|
79 | m_item->setLabel(m_series->name()); | |||
|
80 | } | |||
|
81 | ||||
|
82 | #include "moc_qarealegendmarker.cpp" | |||
|
83 | #include "moc_qarealegendmarker_p.cpp" | |||
|
84 | ||||
|
85 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -0,0 +1,59 | |||||
|
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 | #ifndef QAREALEGENDMARKER_H | |||
|
22 | #define QAREALEGENDMARKER_H | |||
|
23 | ||||
|
24 | #include <QChartGlobal> | |||
|
25 | #include <QLegendMarker> | |||
|
26 | #include <QAreaSeries> | |||
|
27 | ||||
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
29 | ||||
|
30 | class QAreaLegendMarkerPrivate; | |||
|
31 | ||||
|
32 | // TODO: No export? make this private. QLegendMarker should be enough for user of the api (why expose the details?) | |||
|
33 | class QTCOMMERCIALCHART_EXPORT QAreaLegendMarker : public QLegendMarker | |||
|
34 | { | |||
|
35 | Q_OBJECT | |||
|
36 | ||||
|
37 | public: | |||
|
38 | explicit QAreaLegendMarker(QAreaSeries* series, QLegend *legend, QObject *parent = 0); | |||
|
39 | virtual ~QAreaLegendMarker(); | |||
|
40 | ||||
|
41 | virtual QAreaSeries* series(); | |||
|
42 | virtual QAreaSeries* peerObject(); // TODO: rename to slice and remove these virtuals from base class? | |||
|
43 | ||||
|
44 | protected: | |||
|
45 | QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent = 0); | |||
|
46 | ||||
|
47 | //Q_SIGNALS: | |||
|
48 | ||||
|
49 | //public Q_SLOTS: | |||
|
50 | ||||
|
51 | private: | |||
|
52 | Q_DECLARE_PRIVATE(QAreaLegendMarker) | |||
|
53 | Q_DISABLE_COPY(QAreaLegendMarker) | |||
|
54 | ||||
|
55 | }; | |||
|
56 | ||||
|
57 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
58 | ||||
|
59 | #endif // QAREALEGENDMARKER_H |
@@ -0,0 +1,65 | |||||
|
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 QAREALEGENDMARKER_P_H | |||
|
31 | #define QAREALEGENDMARKER_P_H | |||
|
32 | ||||
|
33 | #include "qchartglobal.h" | |||
|
34 | #include "qlegendmarker_p.h" | |||
|
35 | #include "legendmarkeritem_p.h" | |||
|
36 | #include <QAreaSeries> | |||
|
37 | ||||
|
38 | #include <QDebug> | |||
|
39 | ||||
|
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
41 | ||||
|
42 | class QAreaLegendMarker; | |||
|
43 | ||||
|
44 | class QAreaLegendMarkerPrivate : public QLegendMarkerPrivate | |||
|
45 | { | |||
|
46 | Q_OBJECT | |||
|
47 | public: | |||
|
48 | explicit QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend); | |||
|
49 | virtual ~QAreaLegendMarkerPrivate(); | |||
|
50 | ||||
|
51 | public Q_SLOTS: | |||
|
52 | virtual void updated(); | |||
|
53 | ||||
|
54 | private: | |||
|
55 | QAreaLegendMarker *q_ptr; | |||
|
56 | ||||
|
57 | QAreaSeries* m_series; | |||
|
58 | ||||
|
59 | friend class QLegendPrivate; // TODO: Is this needed? | |||
|
60 | Q_DECLARE_PUBLIC(QAreaLegendMarker) | |||
|
61 | }; | |||
|
62 | ||||
|
63 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
64 | ||||
|
65 | #endif // QAREALEGENDMARKER_P_H |
@@ -77,6 +77,7 private: | |||||
77 | Q_DISABLE_COPY(QAreaSeries) |
|
77 | Q_DISABLE_COPY(QAreaSeries) | |
78 | friend class AreaLegendMarker; |
|
78 | friend class AreaLegendMarker; | |
79 | friend class AreaChartItem; |
|
79 | friend class AreaChartItem; | |
|
80 | friend class QAreaLegendMarkerPrivate; | |||
80 | }; |
|
81 | }; | |
81 |
|
82 | |||
82 | QTCOMMERCIALCHART_END_NAMESPACE |
|
83 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -9,7 +9,8 SOURCES += \ | |||||
9 | $$PWD/qpielegendmarker.cpp \ |
|
9 | $$PWD/qpielegendmarker.cpp \ | |
10 | $$PWD/legendmarkeritem.cpp \ |
|
10 | $$PWD/legendmarkeritem.cpp \ | |
11 | $$PWD/qbarlegendmarker.cpp \ |
|
11 | $$PWD/qbarlegendmarker.cpp \ | |
12 | $$PWD/qxylegendmarker.cpp |
|
12 | $$PWD/qxylegendmarker.cpp \ | |
|
13 | $$PWD/qarealegendmarker.cpp | |||
13 |
|
14 | |||
14 | PRIVATE_HEADERS += \ |
|
15 | PRIVATE_HEADERS += \ | |
15 | $$PWD/legendmarker_p.h \ |
|
16 | $$PWD/legendmarker_p.h \ | |
@@ -20,7 +21,8 PRIVATE_HEADERS += \ | |||||
20 | $$PWD/legendmarkeritem_p.h \ |
|
21 | $$PWD/legendmarkeritem_p.h \ | |
21 | $$PWD/qpielegendmarker_p.h \ |
|
22 | $$PWD/qpielegendmarker_p.h \ | |
22 | $$PWD/qbarlegendmarker_p.h \ |
|
23 | $$PWD/qbarlegendmarker_p.h \ | |
23 | $$PWD/qxylegendmarker_p.h |
|
24 | $$PWD/qxylegendmarker_p.h \ | |
|
25 | $$PWD/qarealegendmarker_p.h | |||
24 |
|
26 | |||
25 |
|
27 | |||
26 | PUBLIC_HEADERS += \ |
|
28 | PUBLIC_HEADERS += \ | |
@@ -28,4 +30,5 PUBLIC_HEADERS += \ | |||||
28 | $$PWD/qlegendmarker.h \ |
|
30 | $$PWD/qlegendmarker.h \ | |
29 | $$PWD/qpielegendmarker.h \ |
|
31 | $$PWD/qpielegendmarker.h \ | |
30 | $$PWD/qbarlegendmarker.h \ |
|
32 | $$PWD/qbarlegendmarker.h \ | |
31 | $$PWD/qxylegendmarker.h |
|
33 | $$PWD/qxylegendmarker.h \ | |
|
34 | $$PWD/qarealegendmarker.h |
General Comments 0
You need to be logged in to leave comments.
Login now