1/*
2 * This file is part of KQuickCharts
3 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7
8#ifndef LINEGRIDNODE_H
9#define LINEGRIDNODE_H
10
11#include <QColor>
12#include <QSGGeometryNode>
13
14class QSGFlatColorMaterial;
15
16/**
17 * @todo write docs
18 */
19class LineGridNode : public QSGGeometryNode
20{
21public:
22 LineGridNode();
23 ~LineGridNode();
24
25 void setVisible(bool visible);
26 void setVertical(bool vertical);
27 void setRect(const QRectF &rect);
28 void setColor(const QColor &color);
29 void setSpacing(float spacing);
30 void setLineWidth(float lineWidth);
31
32 bool isSubtreeBlocked() const override;
33
34 void update();
35
36private:
37 void line(QSGGeometry::Point2D *vertices, quint16 *indices, int &index, qreal fromX, qreal fromY, qreal toX, qreal toY);
38
39 QSGGeometry *m_geometry = nullptr;
40 QSGFlatColorMaterial *m_material = nullptr;
41
42 bool m_visible = true;
43 bool m_vertical = false;
44 QRectF m_rect;
45 float m_spacing = 1.0;
46 float m_lineWidth = 1.0;
47};
48
49#endif // LINEGRIDNODE_H
50

source code of kquickcharts/controls/LineGridNode.h