1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the Qt Chart API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef QABSTRACTAXIS_P_H |
14 | #define QABSTRACTAXIS_P_H |
15 | |
16 | #include <QtCharts/QAbstractAxis> |
17 | #include <private/chartaxiselement_p.h> |
18 | #include <QtCharts/QChart> |
19 | #include <QtCharts/private/qchartglobal_p.h> |
20 | #include <QtCore/QDebug> |
21 | |
22 | #include <memory> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | class QGraphicsItem; |
26 | QT_END_NAMESPACE |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class ChartPresenter; |
31 | class AbstractDomain; |
32 | class QChart; |
33 | class QAbstractSeries; |
34 | class ChartTheme; |
35 | class ChartElement; |
36 | |
37 | class Q_CHARTS_PRIVATE_EXPORT QAbstractAxisPrivate : public QObject |
38 | { |
39 | Q_OBJECT |
40 | public: |
41 | QAbstractAxisPrivate(QAbstractAxis *q); |
42 | ~QAbstractAxisPrivate(); |
43 | |
44 | public: |
45 | Qt::Alignment alignment() const { return m_alignment; } |
46 | Qt::Orientation orientation() const { return m_orientation; } |
47 | void setAlignment(Qt::Alignment alignment); |
48 | void setLabelsTruncated(bool labelsTruncated); |
49 | |
50 | virtual void initializeDomain(AbstractDomain *domain) = 0; |
51 | virtual void initializeGraphics(QGraphicsItem *parent) = 0; |
52 | virtual void initializeTheme(ChartTheme* theme, bool forced = false); |
53 | virtual void initializeAnimations(QChart::AnimationOptions options, int duration, |
54 | QEasingCurve &curve); |
55 | |
56 | //interface for manipulating range form base class |
57 | virtual void setMin(const QVariant &min) = 0; |
58 | virtual void setMax(const QVariant &max) = 0; |
59 | virtual void setRange(const QVariant &min, const QVariant &max) = 0; |
60 | |
61 | //interface manipulating range form domain |
62 | virtual void setRange(qreal min, qreal max) = 0; |
63 | virtual qreal min() = 0; |
64 | virtual qreal max() = 0; |
65 | |
66 | ChartAxisElement *axisItem() { return m_item.get(); } |
67 | |
68 | public Q_SLOTS: |
69 | void handleRangeChanged(qreal min, qreal max); |
70 | |
71 | Q_SIGNALS: |
72 | void rangeChanged(qreal min, qreal max); |
73 | |
74 | protected: |
75 | QAbstractAxis *q_ptr; |
76 | QChart *m_chart = nullptr; |
77 | std::unique_ptr<ChartAxisElement> m_item; |
78 | |
79 | private: |
80 | QList<QAbstractSeries*> m_series; |
81 | |
82 | Qt::Alignment m_alignment; |
83 | Qt::Orientation m_orientation = Qt::Orientation(0); |
84 | |
85 | bool m_visible = true; |
86 | |
87 | bool m_arrowVisible = true; |
88 | QPen m_axisPen; |
89 | QBrush m_axisBrush; |
90 | |
91 | bool m_gridLineVisible = true; |
92 | QPen m_gridLinePen; |
93 | bool m_minorGridLineVisible = true; |
94 | QPen m_minorGridLinePen; |
95 | |
96 | bool m_labelsVisible = true; |
97 | bool m_labelsEditable = false; |
98 | QBrush m_labelsBrush; |
99 | QFont m_labelsFont; |
100 | int m_labelsAngle = 0; |
101 | |
102 | bool m_labelsTruncated = false; |
103 | bool m_truncateLabels = true; |
104 | |
105 | bool m_titleVisible = true; |
106 | QBrush m_titleBrush; |
107 | QFont m_titleFont; |
108 | QString m_title; |
109 | |
110 | bool m_shadesVisible = false; |
111 | QPen m_shadesPen; |
112 | QBrush m_shadesBrush; |
113 | qreal m_shadesOpacity = 1; |
114 | |
115 | bool m_dirty = false; |
116 | |
117 | bool m_reverse = false; |
118 | |
119 | Q_DECLARE_PUBLIC(QAbstractAxis); |
120 | friend class QAbstractAxis; |
121 | friend class QColorAxisPrivate; |
122 | friend class ChartDataSet; |
123 | friend class ChartPresenter; |
124 | }; |
125 | |
126 | QT_END_NAMESPACE |
127 | |
128 | #endif |
129 | |