##// END OF EJS Templates
pure virtual getter for series to QLegendMarker. In some cases user don't need the derived pointer. This removes the need to cast to derived marker type
sauimone -
r2181:1afcc57c4e2f
parent child
Show More
@@ -1,57 +1,57
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 #ifndef QAREALEGENDMARKER_H
22 22 #define QAREALEGENDMARKER_H
23 23
24 24 #include <QChartGlobal>
25 25 #include <QLegendMarker>
26 26 #include <QAreaSeries>
27 27
28 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 29
30 30 class QAreaLegendMarkerPrivate;
31 31
32 32 // TODO: No export? make this private. QLegendMarker should be enough for user of the api (why expose the details?)
33 33 class QTCOMMERCIALCHART_EXPORT QAreaLegendMarker : public QLegendMarker
34 34 {
35 35 Q_OBJECT
36 36
37 37 public:
38 38 explicit QAreaLegendMarker(QAreaSeries* series, QLegend *legend, QObject *parent = 0);
39 39 virtual ~QAreaLegendMarker();
40 40
41 41 virtual LegendMarkerType type() { return LegendMarkerTypeArea; }
42 42
43 43 // Related series
44 QAreaSeries* series();
44 virtual QAreaSeries* series();
45 45
46 46 protected:
47 47 QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent = 0);
48 48
49 49 private:
50 50 Q_DECLARE_PRIVATE(QAreaLegendMarker)
51 51 Q_DISABLE_COPY(QAreaLegendMarker)
52 52
53 53 };
54 54
55 55 QTCOMMERCIALCHART_END_NAMESPACE
56 56
57 57 #endif // QAREALEGENDMARKER_H
@@ -1,57 +1,57
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 #ifndef QBARLEGENDMARKER_H
21 21 #define QBARLEGENDMARKER_H
22 22
23 23 #include <QChartGlobal>
24 24 #include <QLegendMarker>
25 25 #include <QAbstractBarSeries>
26 26 #include <QBarSet>
27 27
28 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 29
30 30 class QLegend;
31 31 class QBarLegendMarkerPrivate;
32 32
33 33 class QTCOMMERCIALCHART_EXPORT QBarLegendMarker : public QLegendMarker
34 34 {
35 35 Q_OBJECT
36 36 public:
37 37 explicit QBarLegendMarker(QAbstractBarSeries* series, QBarSet* barset, QLegend *legend, QObject *parent = 0);
38 38 virtual ~QBarLegendMarker();
39 39
40 40 virtual LegendMarkerType type() { return LegendMarkerTypeBar; }
41 41
42 42 // Related series and barset
43 QAbstractBarSeries* series();
43 virtual QAbstractBarSeries* series();
44 44 QBarSet* barset();
45 45
46 46 protected:
47 47 QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent = 0);
48 48
49 49 private:
50 50 Q_DECLARE_PRIVATE(QBarLegendMarker)
51 51 Q_DISABLE_COPY(QBarLegendMarker)
52 52
53 53 };
54 54
55 55 QTCOMMERCIALCHART_END_NAMESPACE
56 56
57 57 #endif // QBARLEGENDMARKER_H
@@ -1,92 +1,94
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 #ifndef QLEGENDMARKER_H
22 22 #define QLEGENDMARKER_H
23 23
24 24 #include <QChartGlobal>
25 25 #include <QObject>
26 26 #include <QPen>
27 27 #include <QBrush>
28 28 #include <QFont>
29 29
30 30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 31
32 32 class QLegendMarkerPrivate;
33 33 class QAbstractSeries;
34 34 class QLegend;
35 35
36 36 class QTCOMMERCIALCHART_EXPORT QLegendMarker : public QObject
37 37 {
38 38 Q_OBJECT
39 39
40 40 public:
41 41 enum LegendMarkerType {
42 42 LegendMarkerTypeArea,
43 43 LegendMarkerTypeBar,
44 44 LegendMarkerTypePie,
45 45 LegendMarkerTypeXY
46 46 };
47 47
48 48 // TODO:
49 49 // Q_PROPERTY(QString label READ label WRITE setlabel NOTIFY labelChanged);
50 50 // Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged);
51 51 // Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged);
52 52
53 53 public:
54 54 virtual ~QLegendMarker();
55 55 virtual LegendMarkerType type() = 0;
56 56
57 57 QString label() const;
58 58 void setLabel(const QString &label);
59 59
60 60 QBrush labelBrush() const;
61 61 void setLabelBrush(const QBrush &brush);
62 62
63 63 QFont font() const;
64 64 void setFont(const QFont &font);
65 65
66 66 QPen pen() const;
67 67 void setPen(const QPen &pen);
68 68
69 69 QBrush brush() const;
70 70 void setBrush(const QBrush &brush);
71 71
72 72 bool isVisible() const;
73 73 void setVisible(bool visible);
74 74
75 virtual QAbstractSeries* series() = 0;
76
75 77 protected:
76 78 explicit QLegendMarker(QLegendMarkerPrivate &d, QObject *parent = 0);
77 79
78 80 Q_SIGNALS:
79 81 void clicked();
80 82 void hovered(bool status);
81 83
82 84 protected:
83 85 QScopedPointer<QLegendMarkerPrivate> d_ptr;
84 86 Q_DISABLE_COPY(QLegendMarker)
85 87 friend class QLegendPrivate;
86 88 friend class QLegendMarkerPrivate;
87 89 friend class LegendLayout;
88 90 };
89 91
90 92 QTCOMMERCIALCHART_END_NAMESPACE
91 93
92 94 #endif // QLEGENDMARKER_H
@@ -1,58 +1,58
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 #ifndef QPIELEGENDMARKER_H
22 22 #define QPIELEGENDMARKER_H
23 23
24 24 #include <QChartGlobal>
25 25 #include <QLegendMarker>
26 26 #include <QPieSeries>
27 27 #include <QPieSlice>
28 28
29 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 31 class QPieLegendMarkerPrivate;
32 32
33 33 // TODO: No export? make this private. QLegendMarker should be enough for user of the api (why expose the details?)
34 34 class QTCOMMERCIALCHART_EXPORT QPieLegendMarker : public QLegendMarker
35 35 {
36 36 Q_OBJECT
37 37
38 38 public:
39 39 explicit QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QLegend *legend, QObject *parent = 0);
40 40 virtual ~QPieLegendMarker();
41 41
42 42 virtual LegendMarkerType type() { return LegendMarkerTypePie; }
43 43
44 44 // Related series and slice
45 QPieSeries* series();
45 virtual QPieSeries* series();
46 46 QPieSlice* slice();
47 47
48 48 protected:
49 49 QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent = 0);
50 50
51 51 private:
52 52 Q_DECLARE_PRIVATE(QPieLegendMarker)
53 53 Q_DISABLE_COPY(QPieLegendMarker)
54 54
55 55 };
56 56
57 57 QTCOMMERCIALCHART_END_NAMESPACE
58 58 #endif // QPIELEGENDMARKER_H
@@ -1,55 +1,55
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 #ifndef QXYLEGENDMARKER_H
22 22 #define QXYLEGENDMARKER_H
23 23
24 24 #include <QChartGlobal>
25 25 #include <QLegendMarker>
26 26 #include <QXYSeries>
27 27
28 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 29
30 30 class QXYLegendMarkerPrivate;
31 31
32 32 class QTCOMMERCIALCHART_EXPORT QXYLegendMarker : public QLegendMarker
33 33 {
34 34 Q_OBJECT
35 35 public:
36 36 explicit QXYLegendMarker(QXYSeries* series, QLegend *legend, QObject *parent = 0);
37 37 virtual ~QXYLegendMarker();
38 38
39 39 virtual LegendMarkerType type() { return LegendMarkerTypeXY; }
40 40
41 41 // Related series
42 QXYSeries* series();
42 virtual QXYSeries* series();
43 43
44 44 protected:
45 45 QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent = 0);
46 46
47 47 private:
48 48 Q_DECLARE_PRIVATE(QXYLegendMarker)
49 49 Q_DISABLE_COPY(QXYLegendMarker)
50 50
51 51 };
52 52
53 53 QTCOMMERCIALCHART_END_NAMESPACE
54 54
55 55 #endif // QXYLEGENDMARKER_H
General Comments 0
You need to be logged in to leave comments. Login now