1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 or (at your option) any later version |
20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
22 | ** included in the packaging of this file. Please review the following |
23 | ** information to ensure the GNU General Public License requirements will |
24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
25 | ** |
26 | ** $QT_END_LICENSE$ |
27 | ** |
28 | ****************************************************************************/ |
29 | |
30 | #ifndef QAREASERIES_H |
31 | #define QAREASERIES_H |
32 | |
33 | #include <QtCharts/QChartGlobal> |
34 | #include <QtCharts/QAbstractSeries> |
35 | #include <QtGui/QPen> |
36 | #include <QtGui/QBrush> |
37 | |
38 | QT_CHARTS_BEGIN_NAMESPACE |
39 | class QLineSeries; |
40 | class QAreaSeriesPrivate; |
41 | |
42 | class Q_CHARTS_EXPORT QAreaSeries : public QAbstractSeries |
43 | { |
44 | Q_OBJECT |
45 | Q_PROPERTY(QtCharts::QLineSeries *upperSeries READ upperSeries) |
46 | Q_PROPERTY(QtCharts::QLineSeries *lowerSeries READ lowerSeries) |
47 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
48 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
49 | Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged) |
50 | Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged) |
51 | Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged) |
52 | Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged) |
53 | Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged) |
54 | |
55 | public: |
56 | explicit QAreaSeries(QObject *parent = nullptr); |
57 | explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr); |
58 | ~QAreaSeries(); |
59 | |
60 | public: |
61 | QAbstractSeries::SeriesType type() const; |
62 | |
63 | void setUpperSeries(QLineSeries *series); |
64 | QLineSeries *upperSeries() const; |
65 | void setLowerSeries(QLineSeries *series); |
66 | QLineSeries *lowerSeries() const; |
67 | |
68 | void setPen(const QPen &pen); |
69 | QPen pen() const; |
70 | |
71 | void setBrush(const QBrush &brush); |
72 | QBrush brush() const; |
73 | |
74 | void setColor(const QColor &color); |
75 | QColor color() const; |
76 | |
77 | void setBorderColor(const QColor &color); |
78 | QColor borderColor() const; |
79 | |
80 | void setPointsVisible(bool visible = true); |
81 | bool pointsVisible() const; |
82 | |
83 | void setPointLabelsFormat(const QString &format); |
84 | QString pointLabelsFormat() const; |
85 | |
86 | void setPointLabelsVisible(bool visible = true); |
87 | bool pointLabelsVisible() const; |
88 | |
89 | void setPointLabelsFont(const QFont &font); |
90 | QFont pointLabelsFont() const; |
91 | |
92 | void setPointLabelsColor(const QColor &color); |
93 | QColor pointLabelsColor() const; |
94 | |
95 | void setPointLabelsClipping(bool enabled = true); |
96 | bool pointLabelsClipping() const; |
97 | |
98 | Q_SIGNALS: |
99 | void clicked(const QPointF &point); |
100 | void hovered(const QPointF &point, bool state); |
101 | void pressed(const QPointF &point); |
102 | void released(const QPointF &point); |
103 | void doubleClicked(const QPointF &point); |
104 | void selected(); |
105 | void colorChanged(QColor color); |
106 | void borderColorChanged(QColor color); |
107 | void pointLabelsFormatChanged(const QString &format); |
108 | void pointLabelsVisibilityChanged(bool visible); |
109 | void pointLabelsFontChanged(const QFont &font); |
110 | void pointLabelsColorChanged(const QColor &color); |
111 | void pointLabelsClippingChanged(bool clipping); |
112 | |
113 | private: |
114 | Q_DECLARE_PRIVATE(QAreaSeries) |
115 | Q_DISABLE_COPY(QAreaSeries) |
116 | friend class AreaLegendMarker; |
117 | friend class AreaChartItem; |
118 | friend class QAreaLegendMarkerPrivate; |
119 | }; |
120 | |
121 | QT_CHARTS_END_NAMESPACE |
122 | |
123 | #endif // QAREASERIES_H |
124 | |