@@ -1,83 +1,84 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2013 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 QABSTRACTBARSERIES_H |
|
22 | 22 | #define QABSTRACTBARSERIES_H |
|
23 | 23 | |
|
24 | 24 | #include <qabstractseries.h> |
|
25 | 25 | #include <QStringList> |
|
26 | 26 | |
|
27 | 27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 28 | |
|
29 | 29 | class QBarSet; |
|
30 | 30 | class QAbstractBarSeriesPrivate; |
|
31 | 31 | |
|
32 | 32 | // Container for series |
|
33 | 33 | class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries |
|
34 | 34 | { |
|
35 | 35 | Q_OBJECT |
|
36 | 36 | Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth) |
|
37 | 37 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
38 | 38 | Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
39 | 39 | |
|
40 | 40 | public: |
|
41 | 41 | virtual ~QAbstractBarSeries(); |
|
42 | 42 | |
|
43 | 43 | void setBarWidth(qreal width); |
|
44 | 44 | qreal barWidth() const; |
|
45 | 45 | |
|
46 | 46 | bool append(QBarSet *set); |
|
47 | 47 | bool remove(QBarSet *set); |
|
48 | 48 | bool take(QBarSet *set); |
|
49 | 49 | bool append(QList<QBarSet *> sets); |
|
50 | 50 | bool insert(int index, QBarSet *set); |
|
51 | 51 | int count() const; |
|
52 | 52 | QList<QBarSet *> barSets() const; |
|
53 | 53 | void clear(); |
|
54 | 54 | |
|
55 | 55 | void setLabelsVisible(bool visible = true); |
|
56 | 56 | bool isLabelsVisible() const; |
|
57 | 57 | |
|
58 | 58 | protected: |
|
59 | 59 | explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = 0); |
|
60 | 60 | |
|
61 | 61 | Q_SIGNALS: |
|
62 | 62 | void clicked(int index, QBarSet *barset); |
|
63 | 63 | void hovered(bool status, QBarSet *barset); |
|
64 | 64 | void countChanged(); |
|
65 | 65 | void labelsVisibleChanged(); |
|
66 | 66 | |
|
67 | 67 | void barsetsAdded(QList<QBarSet *> sets); |
|
68 | 68 | void barsetsRemoved(QList<QBarSet *> sets); |
|
69 | 69 | |
|
70 | 70 | protected: |
|
71 | 71 | Q_DECLARE_PRIVATE(QAbstractBarSeries) |
|
72 | 72 | friend class AbstractBarChartItem; |
|
73 | 73 | friend class PercentBarChartItem; |
|
74 | 74 | friend class StackedBarChartItem; |
|
75 | friend class BoxPlotChartItem; | |
|
75 | 76 | friend class BarChartItem; |
|
76 | 77 | friend class HorizontalBarChartItem; |
|
77 | 78 | friend class HorizontalStackedBarChartItem; |
|
78 | 79 | friend class HorizontalPercentBarChartItem; |
|
79 | 80 | }; |
|
80 | 81 | |
|
81 | 82 | QTCOMMERCIALCHART_END_NAMESPACE |
|
82 | 83 | |
|
83 | 84 | #endif // QABSTRACTBARSERIES_H |
@@ -1,118 +1,119 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2013 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 QBARSET_H |
|
22 | 22 | #define QBARSET_H |
|
23 | 23 | |
|
24 | 24 | #include <qchartglobal.h> |
|
25 | 25 | #include <QPen> |
|
26 | 26 | #include <QBrush> |
|
27 | 27 | #include <QFont> |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | class QBarSetPrivate; |
|
31 | 31 | |
|
32 | 32 | class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject |
|
33 | 33 | { |
|
34 | 34 | Q_OBJECT |
|
35 | 35 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) |
|
36 | 36 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
|
37 | 37 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
|
38 | 38 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) |
|
39 | 39 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) |
|
40 | 40 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
|
41 | 41 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
|
42 | 42 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) |
|
43 | 43 | |
|
44 | 44 | public: |
|
45 | 45 | explicit QBarSet(const QString label, QObject *parent = 0); |
|
46 | 46 | virtual ~QBarSet(); |
|
47 | 47 | |
|
48 | 48 | void setLabel(const QString label); |
|
49 | 49 | QString label() const; |
|
50 | 50 | |
|
51 | 51 | void append(const qreal value); |
|
52 | 52 | void append(const QList<qreal> &values); |
|
53 | 53 | |
|
54 | 54 | QBarSet &operator << (const qreal &value); |
|
55 | 55 | |
|
56 | 56 | void insert(const int index, const qreal value); |
|
57 | 57 | void remove(const int index, const int count = 1); |
|
58 | 58 | void replace(const int index, const qreal value); |
|
59 | 59 | qreal at(const int index) const; |
|
60 | 60 | qreal operator [](const int index) const; |
|
61 | 61 | int count() const; |
|
62 | 62 | qreal sum() const; |
|
63 | 63 | |
|
64 | 64 | void setPen(const QPen &pen); |
|
65 | 65 | QPen pen() const; |
|
66 | 66 | |
|
67 | 67 | void setBrush(const QBrush &brush); |
|
68 | 68 | QBrush brush() const; |
|
69 | 69 | |
|
70 | 70 | void setLabelBrush(const QBrush &brush); |
|
71 | 71 | QBrush labelBrush() const; |
|
72 | 72 | |
|
73 | 73 | void setLabelFont(const QFont &font); |
|
74 | 74 | QFont labelFont() const; |
|
75 | 75 | |
|
76 | 76 | QColor color(); |
|
77 | 77 | void setColor(QColor color); |
|
78 | 78 | |
|
79 | 79 | QColor borderColor(); |
|
80 | 80 | void setBorderColor(QColor color); |
|
81 | 81 | |
|
82 | 82 | QColor labelColor(); |
|
83 | 83 | void setLabelColor(QColor color); |
|
84 | 84 | |
|
85 | 85 | Q_SIGNALS: |
|
86 | 86 | void clicked(int index); |
|
87 | 87 | void hovered(bool status); |
|
88 | 88 | void penChanged(); |
|
89 | 89 | void brushChanged(); |
|
90 | 90 | void labelChanged(); |
|
91 | 91 | void labelBrushChanged(); |
|
92 | 92 | void labelFontChanged(); |
|
93 | 93 | void colorChanged(QColor color); |
|
94 | 94 | void borderColorChanged(QColor color); |
|
95 | 95 | void labelColorChanged(QColor color); |
|
96 | 96 | |
|
97 | 97 | void valuesAdded(int index, int count); |
|
98 | 98 | void valuesRemoved(int index, int count); |
|
99 | 99 | void valueChanged(int index); |
|
100 | 100 | |
|
101 | 101 | private: |
|
102 | 102 | QScopedPointer<QBarSetPrivate> d_ptr; |
|
103 | 103 | Q_DISABLE_COPY(QBarSet) |
|
104 | 104 | friend class QAbstractBarSeries; |
|
105 | 105 | friend class BarLegendMarker; |
|
106 | 106 | friend class AbstractBarChartItem; |
|
107 | 107 | friend class QAbstractBarSeriesPrivate; |
|
108 | 108 | friend class StackedBarChartItem; |
|
109 | 109 | friend class PercentBarChartItem; |
|
110 | 110 | friend class BarChartItem; |
|
111 | 111 | friend class HorizontalBarChartItem; |
|
112 | 112 | friend class HorizontalStackedBarChartItem; |
|
113 | 113 | friend class HorizontalPercentBarChartItem; |
|
114 | friend class BoxPlotChartItem; | |
|
114 | 115 | }; |
|
115 | 116 | |
|
116 | 117 | QTCOMMERCIALCHART_END_NAMESPACE |
|
117 | 118 | |
|
118 | 119 | #endif // QBARSET_H |
General Comments 0
You need to be logged in to leave comments.
Login now