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 CARTESIANCHARTAXIS_H |
14 | #define CARTESIANCHARTAXIS_H |
15 | |
16 | #include <QtCharts/QChartGlobal> |
17 | #include <private/chartaxiselement_p.h> |
18 | #include <QtCharts/private/qchartglobal_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QAbstractAxis; |
23 | |
24 | class Q_CHARTS_PRIVATE_EXPORT CartesianChartAxis : public ChartAxisElement |
25 | { |
26 | Q_OBJECT |
27 | Q_INTERFACES(QGraphicsLayoutItem) |
28 | public: |
29 | |
30 | CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false); |
31 | ~CartesianChartAxis(); |
32 | |
33 | void setGeometry(const QRectF &axis, const QRectF &grid) override; |
34 | QRectF gridGeometry() const override { return m_gridRect; } |
35 | bool emptyAxis() const override; |
36 | |
37 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override; |
38 | |
39 | void setDateTimeLabelsFormat(const QString &format); |
40 | |
41 | protected: |
42 | void setGeometry(const QRectF &size) override { Q_UNUSED(size);} |
43 | void updateGeometry() override = 0; |
44 | void updateLayout(const QList<qreal> &layout) override; |
45 | |
46 | public Q_SLOTS: |
47 | void handleArrowPenChanged(const QPen &pen) override; |
48 | void handleGridPenChanged(const QPen &pen) override; |
49 | void handleShadesBrushChanged(const QBrush &brush) override; |
50 | void handleShadesPenChanged(const QPen &pen) override; |
51 | void handleMinorArrowPenChanged(const QPen &pen) override; |
52 | void handleMinorGridPenChanged(const QPen &pen) override; |
53 | void handleGridLineColorChanged(const QColor &color) override; |
54 | void handleMinorGridLineColorChanged(const QColor &color) override; |
55 | |
56 | protected: |
57 | void updateLabelsValues(QValueAxis *axis); |
58 | void updateLabelsDateTimes(); |
59 | |
60 | private: |
61 | void createItems(int count); |
62 | void deleteItems(int count); |
63 | void updateMinorTickItems(); |
64 | |
65 | private: |
66 | QRectF m_gridRect; |
67 | |
68 | friend class AxisAnimation; |
69 | friend class LineArrowItem; |
70 | }; |
71 | |
72 | QT_END_NAMESPACE |
73 | |
74 | #endif /* CARTESIANCHARTAXIS_H */ |
75 | |