@@ -0,0 +1,127 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2013 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 "qboxplotlegendmarker.h" | |||
|
22 | #include "qboxplotlegendmarker_p.h" | |||
|
23 | #include "qboxplotseries.h" | |||
|
24 | #include "qboxplotseries_p.h" | |||
|
25 | #include <QBoxPlotSeries> | |||
|
26 | ||||
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
28 | ||||
|
29 | /*! | |||
|
30 | \class QBoxPlotLegendMarker | |||
|
31 | \brief QBoxPlotLegendMarker object | |||
|
32 | \mainclass | |||
|
33 | ||||
|
34 | QBoxPlotLegendMarker is related to xxx derived classes. | |||
|
35 | ||||
|
36 | \sa QLegend QXYSeries QSplineSeries QScatterSeries QLineSeries | |||
|
37 | */ | |||
|
38 | ||||
|
39 | /*! | |||
|
40 | \fn virtual LegendMarkerType QBoxPlotLegendMarker::type() | |||
|
41 | Returns QLegendMarker::LegendMarkerTypeBoxPlot | |||
|
42 | */ | |||
|
43 | ||||
|
44 | /*! | |||
|
45 | \internal | |||
|
46 | */ | |||
|
47 | QBoxPlotLegendMarker::QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent) : | |||
|
48 | QLegendMarker(*new QBoxPlotLegendMarkerPrivate(this,series,legend), parent) | |||
|
49 | { | |||
|
50 | d_ptr->updated(); | |||
|
51 | } | |||
|
52 | ||||
|
53 | /*! | |||
|
54 | Destructor | |||
|
55 | */ | |||
|
56 | QBoxPlotLegendMarker::~QBoxPlotLegendMarker() | |||
|
57 | { | |||
|
58 | } | |||
|
59 | ||||
|
60 | /*! | |||
|
61 | \internal | |||
|
62 | */ | |||
|
63 | QBoxPlotLegendMarker::QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent) : | |||
|
64 | QLegendMarker(d, parent) | |||
|
65 | { | |||
|
66 | } | |||
|
67 | ||||
|
68 | /*! | |||
|
69 | Returns the related series | |||
|
70 | */ | |||
|
71 | QBoxPlotSeries* QBoxPlotLegendMarker::series() | |||
|
72 | { | |||
|
73 | Q_D(QBoxPlotLegendMarker); | |||
|
74 | return d->m_series; | |||
|
75 | } | |||
|
76 | ||||
|
77 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
|
78 | ||||
|
79 | QBoxPlotLegendMarkerPrivate::QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend) : | |||
|
80 | QLegendMarkerPrivate(q,legend), | |||
|
81 | q_ptr(q), | |||
|
82 | m_series(series) | |||
|
83 | { | |||
|
84 | QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated())); | |||
|
85 | QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(updated())); | |||
|
86 | } | |||
|
87 | ||||
|
88 | QBoxPlotLegendMarkerPrivate::~QBoxPlotLegendMarkerPrivate() | |||
|
89 | { | |||
|
90 | } | |||
|
91 | ||||
|
92 | QAbstractSeries* QBoxPlotLegendMarkerPrivate::series() | |||
|
93 | { | |||
|
94 | return m_series; | |||
|
95 | } | |||
|
96 | ||||
|
97 | QObject* QBoxPlotLegendMarkerPrivate::relatedObject() | |||
|
98 | { | |||
|
99 | return m_series; | |||
|
100 | } | |||
|
101 | ||||
|
102 | void QBoxPlotLegendMarkerPrivate::updated() | |||
|
103 | { | |||
|
104 | bool labelChanged = false; | |||
|
105 | bool brushChanged = false; | |||
|
106 | ||||
|
107 | if (!m_customLabel && (m_item->label() != m_series->name())) { | |||
|
108 | m_item->setLabel(m_series->name()); | |||
|
109 | labelChanged = true; | |||
|
110 | } | |||
|
111 | if (!m_customBrush && (m_item->brush() != m_series->brush())) { | |||
|
112 | m_item->setBrush(m_series->brush()); | |||
|
113 | brushChanged = true; | |||
|
114 | } | |||
|
115 | invalidateLegend(); | |||
|
116 | ||||
|
117 | if (labelChanged) | |||
|
118 | emit q_ptr->labelChanged(); | |||
|
119 | if (brushChanged) | |||
|
120 | emit q_ptr->brushChanged(); | |||
|
121 | } | |||
|
122 | ||||
|
123 | #include "moc_qboxplotlegendmarker.cpp" | |||
|
124 | #include "moc_qboxplotlegendmarker_p.cpp" | |||
|
125 | ||||
|
126 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
127 |
@@ -0,0 +1,55 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2013 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 QBOXPLOTLEGENDMARKER_H | |||
|
22 | #define QBOXPLOTLEGENDMARKER_H | |||
|
23 | ||||
|
24 | #include <QChartGlobal> | |||
|
25 | #include <QLegendMarker> | |||
|
26 | #include <QBoxPlotSeries> | |||
|
27 | ||||
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
29 | ||||
|
30 | class QBoxPlotLegendMarkerPrivate; | |||
|
31 | ||||
|
32 | class QTCOMMERCIALCHART_EXPORT QBoxPlotLegendMarker : public QLegendMarker | |||
|
33 | { | |||
|
34 | Q_OBJECT | |||
|
35 | ||||
|
36 | public: | |||
|
37 | explicit QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent = 0); | |||
|
38 | virtual ~QBoxPlotLegendMarker(); | |||
|
39 | ||||
|
40 | virtual LegendMarkerType type() { return LegendMarkerTypeBoxPlot; } | |||
|
41 | ||||
|
42 | // Related series | |||
|
43 | virtual QBoxPlotSeries* series(); | |||
|
44 | ||||
|
45 | protected: | |||
|
46 | QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent = 0); | |||
|
47 | ||||
|
48 | private: | |||
|
49 | Q_DECLARE_PRIVATE(QBoxPlotLegendMarker) | |||
|
50 | Q_DISABLE_COPY(QBoxPlotLegendMarker) | |||
|
51 | }; | |||
|
52 | ||||
|
53 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
54 | ||||
|
55 | #endif // QBOXPLOTLEGENDMARKER_H |
@@ -0,0 +1,64 | |||||
|
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 QBOXPLOTLEGENDMARKER_P_H | |||
|
31 | #define QBOXPLOTLEGENDMARKER_P_H | |||
|
32 | ||||
|
33 | #include "qchartglobal.h" | |||
|
34 | #include "qlegendmarker_p.h" | |||
|
35 | #include "legendmarkeritem_p.h" | |||
|
36 | #include <QBoxPlotSeries> | |||
|
37 | ||||
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
39 | ||||
|
40 | class QBoxPlotLegendMarker; | |||
|
41 | ||||
|
42 | class QBoxPlotLegendMarkerPrivate : public QLegendMarkerPrivate | |||
|
43 | { | |||
|
44 | Q_OBJECT | |||
|
45 | public: | |||
|
46 | explicit QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend); | |||
|
47 | virtual ~QBoxPlotLegendMarkerPrivate(); | |||
|
48 | ||||
|
49 | virtual QAbstractSeries* series(); | |||
|
50 | virtual QObject* relatedObject(); | |||
|
51 | ||||
|
52 | public Q_SLOTS: | |||
|
53 | virtual void updated(); | |||
|
54 | ||||
|
55 | private: | |||
|
56 | QBoxPlotLegendMarker *q_ptr; | |||
|
57 | QBoxPlotSeries *m_series; | |||
|
58 | ||||
|
59 | Q_DECLARE_PUBLIC(QBoxPlotLegendMarker) | |||
|
60 | }; | |||
|
61 | ||||
|
62 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
63 | ||||
|
64 | #endif // QBOXPLOTLEGENDMARKER_P_H |
@@ -1,33 +1,36 | |||||
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/legendlayout.cpp \ |
|
6 | $$PWD/legendlayout.cpp \ | |
7 | $$PWD/qlegendmarker.cpp \ |
|
7 | $$PWD/qlegendmarker.cpp \ | |
8 | $$PWD/qpielegendmarker.cpp \ |
|
8 | $$PWD/qpielegendmarker.cpp \ | |
9 | $$PWD/legendmarkeritem.cpp \ |
|
9 | $$PWD/legendmarkeritem.cpp \ | |
10 | $$PWD/qbarlegendmarker.cpp \ |
|
10 | $$PWD/qbarlegendmarker.cpp \ | |
11 | $$PWD/qxylegendmarker.cpp \ |
|
11 | $$PWD/qxylegendmarker.cpp \ | |
12 | $$PWD/qarealegendmarker.cpp \ |
|
12 | $$PWD/qarealegendmarker.cpp \ | |
13 | $$PWD/legendscroller.cpp |
|
13 | $$PWD/legendscroller.cpp \ | |
|
14 | $$PWD/qboxplotlegendmarker.cpp | |||
14 |
|
15 | |||
15 | PRIVATE_HEADERS += \ |
|
16 | PRIVATE_HEADERS += \ | |
16 | $$PWD/legendscroller_p.h \ |
|
17 | $$PWD/legendscroller_p.h \ | |
17 | $$PWD/qlegend_p.h \ |
|
18 | $$PWD/qlegend_p.h \ | |
18 | $$PWD/legendlayout_p.h \ |
|
19 | $$PWD/legendlayout_p.h \ | |
19 | $$PWD/qlegendmarker_p.h \ |
|
20 | $$PWD/qlegendmarker_p.h \ | |
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 \ | |
24 | $$PWD/qarealegendmarker_p.h |
|
25 | $$PWD/qarealegendmarker_p.h \ | |
|
26 | $$PWD/qboxplotlegendmarker_p.h | |||
25 |
|
27 | |||
26 |
|
28 | |||
27 | PUBLIC_HEADERS += \ |
|
29 | PUBLIC_HEADERS += \ | |
28 | $$PWD/qlegend.h \ |
|
30 | $$PWD/qlegend.h \ | |
29 | $$PWD/qlegendmarker.h \ |
|
31 | $$PWD/qlegendmarker.h \ | |
30 | $$PWD/qpielegendmarker.h \ |
|
32 | $$PWD/qpielegendmarker.h \ | |
31 | $$PWD/qbarlegendmarker.h \ |
|
33 | $$PWD/qbarlegendmarker.h \ | |
32 | $$PWD/qxylegendmarker.h \ |
|
34 | $$PWD/qxylegendmarker.h \ | |
33 | $$PWD/qarealegendmarker.h |
|
35 | $$PWD/qarealegendmarker.h \ | |
|
36 | $$PWD/qboxplotlegendmarker.h |
General Comments 0
You need to be logged in to leave comments.
Login now