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