1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef AXISLINE_H
5#define AXISLINE_H
6
7// W A R N I N G
8// -------------
9//
10// This file is not part of the QtGraphs API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15
16#include <QtQuick/private/qquickshadereffect_p.h>
17#include <QQmlEngine>
18
19QT_BEGIN_NAMESPACE
20
21class AxisLine : public QQuickShaderEffect
22{
23 Q_OBJECT
24 Q_PROPERTY(QVector3D iResolution READ iResolution NOTIFY iResolutionChanged FINAL)
25 Q_PROPERTY(qreal smoothing READ smoothing WRITE setSmoothing NOTIFY smoothingChanged FINAL)
26 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
27 Q_PROPERTY(qreal lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged FINAL)
28 Q_PROPERTY(bool isHorizontal READ isHorizontal WRITE setIsHorizontal NOTIFY isHorizontalChanged FINAL)
29public:
30 explicit AxisLine(QQuickItem *parent = nullptr);
31 ~AxisLine() override;
32 void setupShaders();
33
34 QVector3D iResolution() const;
35
36 qreal smoothing() const;
37 void setSmoothing(qreal newSmoothing);
38
39 QColor color() const;
40 void setColor(QColor newColor);
41
42 qreal lineWidth() const;
43 void setLineWidth(qreal newLineWidth);
44
45 bool isHorizontal() const;
46 void setIsHorizontal(bool newIsHorizontal);
47
48protected:
49 void componentComplete() override;
50 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
51
52Q_SIGNALS:
53 void iResolutionChanged();
54 void smoothingChanged();
55 void colorChanged();
56 void lineWidthChanged();
57 void isHorizontalChanged();
58
59private:
60 friend class AxisRenderer;
61 QVector3D m_iResolution;
62 qreal m_smoothing = 1.0;
63 QColor m_color = QColor(255, 255, 255);
64 qreal m_lineWidth = 2.0;
65 bool m_isHorizontal = false;
66};
67
68QT_END_NAMESPACE
69
70#endif // AXISLINE_H
71

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtgraphs/src/graphs2d/axis/axisline_p.h