@@ -0,0 +1,91 | |||
|
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 "qxylegendmarker.h" | |
|
22 | #include "qxylegendmarker_p.h" | |
|
23 | #include "qxyseries_p.h" | |
|
24 | #include <QXYSeries> | |
|
25 | #include <QDebug> | |
|
26 | ||
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
28 | ||
|
29 | QXYLegendMarker::QXYLegendMarker(QXYSeries* series, QLegend *legend, QObject *parent) : | |
|
30 | QLegendMarker(*new QXYLegendMarkerPrivate(this,series,legend), parent) | |
|
31 | { | |
|
32 | } | |
|
33 | ||
|
34 | QXYLegendMarker::~QXYLegendMarker() | |
|
35 | { | |
|
36 | // qDebug() << "deleting xy marker" << this; | |
|
37 | } | |
|
38 | ||
|
39 | /*! | |
|
40 | \internal | |
|
41 | */ | |
|
42 | QXYLegendMarker::QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent) : | |
|
43 | QLegendMarker(d, parent) | |
|
44 | { | |
|
45 | } | |
|
46 | ||
|
47 | QXYSeries* QXYLegendMarker::series() | |
|
48 | { | |
|
49 | Q_D(QXYLegendMarker); | |
|
50 | return d->m_series; | |
|
51 | } | |
|
52 | ||
|
53 | QXYSeries* QXYLegendMarker::peerObject() | |
|
54 | { | |
|
55 | Q_D(QXYLegendMarker); | |
|
56 | return d->m_series; | |
|
57 | } | |
|
58 | ||
|
59 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
|
60 | ||
|
61 | QXYLegendMarkerPrivate::QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend) : | |
|
62 | QLegendMarkerPrivate(q,legend), | |
|
63 | m_series(series) | |
|
64 | { | |
|
65 | QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated())); | |
|
66 | QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(updated())); | |
|
67 | updated(); | |
|
68 | } | |
|
69 | ||
|
70 | QXYLegendMarkerPrivate::~QXYLegendMarkerPrivate() | |
|
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 QXYLegendMarkerPrivate::updated() | |
|
77 | { | |
|
78 | m_item->setLabel(m_series->name()); | |
|
79 | ||
|
80 | if (m_series->type()== QAbstractSeries::SeriesTypeScatter) { | |
|
81 | m_item->setBrush(m_series->brush()); | |
|
82 | } else { | |
|
83 | m_item->setBrush(QBrush(m_series->pen().color())); | |
|
84 | } | |
|
85 | } | |
|
86 | ||
|
87 | #include "moc_qxylegendmarker.cpp" | |
|
88 | #include "moc_qxylegendmarker_p.cpp" | |
|
89 | ||
|
90 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
91 |
@@ -0,0 +1,57 | |||
|
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 QXYLEGENDMARKER_H | |
|
22 | #define QXYLEGENDMARKER_H | |
|
23 | ||
|
24 | #include <QChartGlobal> | |
|
25 | #include <QLegendMarker> | |
|
26 | #include <QXYSeries> | |
|
27 | ||
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
29 | ||
|
30 | class QXYLegendMarkerPrivate; | |
|
31 | ||
|
32 | class QTCOMMERCIALCHART_EXPORT QXYLegendMarker : public QLegendMarker | |
|
33 | { | |
|
34 | Q_OBJECT | |
|
35 | public: | |
|
36 | explicit QXYLegendMarker(QXYSeries* series, QLegend *legend, QObject *parent = 0); | |
|
37 | virtual ~QXYLegendMarker(); | |
|
38 | ||
|
39 | virtual QXYSeries* series(); | |
|
40 | virtual QXYSeries* peerObject(); // TODO: rename to slice and remove these virtuals from base class? | |
|
41 | ||
|
42 | protected: | |
|
43 | QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent = 0); | |
|
44 | ||
|
45 | //Q_SIGNALS: | |
|
46 | ||
|
47 | //public Q_SLOTS: | |
|
48 | ||
|
49 | private: | |
|
50 | Q_DECLARE_PRIVATE(QXYLegendMarker) | |
|
51 | Q_DISABLE_COPY(QXYLegendMarker) | |
|
52 | ||
|
53 | }; | |
|
54 | ||
|
55 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
56 | ||
|
57 | #endif // QXYLEGENDMARKER_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 QXYLEGENDMARKER_P_H | |
|
31 | #define QXYLEGENDMARKER_P_H | |
|
32 | ||
|
33 | #include "qchartglobal.h" | |
|
34 | #include "qlegendmarker_p.h" | |
|
35 | #include "legendmarkeritem_p.h" | |
|
36 | #include <QXYSeries> | |
|
37 | ||
|
38 | #include <QDebug> | |
|
39 | ||
|
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
41 | ||
|
42 | class QXYLegendMarker; | |
|
43 | ||
|
44 | class QXYLegendMarkerPrivate : public QLegendMarkerPrivate | |
|
45 | { | |
|
46 | Q_OBJECT | |
|
47 | public: | |
|
48 | explicit QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend); | |
|
49 | virtual ~QXYLegendMarkerPrivate(); | |
|
50 | ||
|
51 | public Q_SLOTS: | |
|
52 | virtual void updated(); | |
|
53 | ||
|
54 | private: | |
|
55 | QXYLegendMarker *q_ptr; | |
|
56 | ||
|
57 | QXYSeries* m_series; | |
|
58 | ||
|
59 | friend class QLegendPrivate; // TODO: Is this needed? | |
|
60 | Q_DECLARE_PUBLIC(QXYLegendMarker) | |
|
61 | }; | |
|
62 | ||
|
63 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
64 | ||
|
65 | #endif // QXYLEGENDMARKER_P_H |
@@ -8,7 +8,8 SOURCES += \ | |||
|
8 | 8 | $$PWD/qlegendmarker.cpp \ |
|
9 | 9 | $$PWD/qpielegendmarker.cpp \ |
|
10 | 10 | $$PWD/legendmarkeritem.cpp \ |
|
11 | $$PWD/qbarlegendmarker.cpp | |
|
11 | $$PWD/qbarlegendmarker.cpp \ | |
|
12 | $$PWD/qxylegendmarker.cpp | |
|
12 | 13 | |
|
13 | 14 | PRIVATE_HEADERS += \ |
|
14 | 15 | $$PWD/legendmarker_p.h \ |
@@ -18,11 +19,13 PRIVATE_HEADERS += \ | |||
|
18 | 19 | $$PWD/qlegendmarker_p.h \ |
|
19 | 20 | $$PWD/legendmarkeritem_p.h \ |
|
20 | 21 | $$PWD/qpielegendmarker_p.h \ |
|
21 | $$PWD/qbarlegendmarker_p.h | |
|
22 | $$PWD/qbarlegendmarker_p.h \ | |
|
23 | $$PWD/qxylegendmarker_p.h | |
|
22 | 24 | |
|
23 | 25 | |
|
24 | 26 | PUBLIC_HEADERS += \ |
|
25 | 27 | $$PWD/qlegend.h \ |
|
26 | 28 | $$PWD/qlegendmarker.h \ |
|
27 | 29 | $$PWD/qpielegendmarker.h \ |
|
28 | $$PWD/qbarlegendmarker.h | |
|
30 | $$PWD/qbarlegendmarker.h \ | |
|
31 | $$PWD/qxylegendmarker.h |
@@ -24,6 +24,8 | |||
|
24 | 24 | #include "legendmarker_p.h" |
|
25 | 25 | #include "qvalueaxis.h" |
|
26 | 26 | |
|
27 | #include "qxylegendmarker.h" | |
|
28 | ||
|
27 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 30 | |
|
29 | 31 | /*! |
@@ -456,12 +458,9 QList<LegendMarker *> QXYSeriesPrivate::createLegendMarker(QLegend *legend) | |||
|
456 | 458 | |
|
457 | 459 | QList<QLegendMarker*> QXYSeriesPrivate::createLegendMarkers(QLegend* legend) |
|
458 | 460 | { |
|
459 | Q_UNUSED(legend); | |
|
460 | // Q_Q(QXYSeries); | |
|
461 | Q_Q(QXYSeries); | |
|
461 | 462 | QList<QLegendMarker*> list; |
|
462 | // TODO: | |
|
463 | // return list << new QXYLegendMarker(q,legend); | |
|
464 | return list; | |
|
463 | return list << new QXYLegendMarker(q,legend); | |
|
465 | 464 | } |
|
466 | 465 | |
|
467 | 466 | void QXYSeriesPrivate::initializeAxis(QAbstractAxis *axis) |
General Comments 0
You need to be logged in to leave comments.
Login now