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 | // W A R N I N G |
31 | // ------------- |
32 | // |
33 | // This file is not part of the Qt Chart API. It exists purely as an |
34 | // implementation detail. This header file may change from version to |
35 | // version without notice, or even be removed. |
36 | // |
37 | // We mean it. |
38 | |
39 | #ifndef QABSTRACTAXIS_P_H |
40 | #define QABSTRACTAXIS_P_H |
41 | |
42 | #include <QtCharts/QAbstractAxis> |
43 | #include <private/chartaxiselement_p.h> |
44 | #include <QtCharts/QChart> |
45 | #include <QtCharts/private/qchartglobal_p.h> |
46 | #include <QtCore/QDebug> |
47 | |
48 | QT_BEGIN_NAMESPACE |
49 | class QGraphicsItem; |
50 | QT_END_NAMESPACE |
51 | |
52 | QT_CHARTS_BEGIN_NAMESPACE |
53 | |
54 | class ChartPresenter; |
55 | class AbstractDomain; |
56 | class QChart; |
57 | class QAbstractSeries; |
58 | class ChartTheme; |
59 | class ChartElement; |
60 | |
61 | class Q_CHARTS_PRIVATE_EXPORT QAbstractAxisPrivate : public QObject |
62 | { |
63 | Q_OBJECT |
64 | public: |
65 | QAbstractAxisPrivate(QAbstractAxis *q); |
66 | ~QAbstractAxisPrivate(); |
67 | |
68 | public: |
69 | Qt::Alignment alignment() const { return m_alignment; } |
70 | Qt::Orientation orientation() const { return m_orientation; } |
71 | void setAlignment( Qt::Alignment alignment); |
72 | |
73 | virtual void initializeDomain(AbstractDomain *domain) = 0; |
74 | virtual void initializeGraphics(QGraphicsItem *parent) = 0; |
75 | virtual void initializeTheme(ChartTheme* theme, bool forced = false); |
76 | virtual void initializeAnimations(QChart::AnimationOptions options, int duration, |
77 | QEasingCurve &curve); |
78 | |
79 | //interface for manipulating range form base class |
80 | virtual void setMin(const QVariant &min) = 0; |
81 | virtual void setMax(const QVariant &max) = 0; |
82 | virtual void setRange(const QVariant &min, const QVariant &max) = 0; |
83 | |
84 | //interface manipulating range form domain |
85 | virtual void setRange(qreal min, qreal max) = 0; |
86 | virtual qreal min() = 0; |
87 | virtual qreal max() = 0; |
88 | |
89 | ChartAxisElement *axisItem() { return m_item.data(); } |
90 | |
91 | public Q_SLOTS: |
92 | void handleRangeChanged(qreal min, qreal max); |
93 | |
94 | Q_SIGNALS: |
95 | void rangeChanged(qreal min, qreal max); |
96 | |
97 | protected: |
98 | QAbstractAxis *q_ptr; |
99 | QChart *m_chart = nullptr; |
100 | QScopedPointer<ChartAxisElement> m_item; |
101 | |
102 | private: |
103 | QList<QAbstractSeries*> m_series; |
104 | |
105 | Qt::Alignment m_alignment; |
106 | Qt::Orientation m_orientation = Qt::Orientation(0); |
107 | |
108 | bool m_visible = true; |
109 | |
110 | bool m_arrowVisible = true; |
111 | QPen m_axisPen; |
112 | QBrush m_axisBrush; |
113 | |
114 | bool m_gridLineVisible = true; |
115 | QPen m_gridLinePen; |
116 | bool m_minorGridLineVisible = true; |
117 | QPen m_minorGridLinePen; |
118 | |
119 | bool m_labelsVisible = true; |
120 | bool m_labelsEditable = false; |
121 | QBrush m_labelsBrush; |
122 | QFont m_labelsFont; |
123 | int m_labelsAngle = 0; |
124 | |
125 | bool m_titleVisible = true; |
126 | QBrush m_titleBrush; |
127 | QFont m_titleFont; |
128 | QString m_title; |
129 | |
130 | bool m_shadesVisible = false; |
131 | QPen m_shadesPen; |
132 | QBrush m_shadesBrush; |
133 | qreal m_shadesOpacity = 1; |
134 | |
135 | bool m_dirty = false; |
136 | |
137 | bool m_reverse = false; |
138 | |
139 | friend class QAbstractAxis; |
140 | friend class ChartDataSet; |
141 | friend class ChartPresenter; |
142 | }; |
143 | |
144 | QT_CHARTS_END_NAMESPACE |
145 | |
146 | #endif |
147 | |