File indexing completed on 2024-04-21 03:56:42
0001 /* 0002 * This file is part of KQuickCharts 0003 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef LINEGRIDNODE_H 0009 #define LINEGRIDNODE_H 0010 0011 #include <QColor> 0012 #include <QSGGeometryNode> 0013 0014 class QSGFlatColorMaterial; 0015 0016 /** 0017 * @todo write docs 0018 */ 0019 class LineGridNode : public QSGGeometryNode 0020 { 0021 public: 0022 LineGridNode(); 0023 ~LineGridNode(); 0024 0025 void setVisible(bool visible); 0026 void setVertical(bool vertical); 0027 void setRect(const QRectF &rect); 0028 void setColor(const QColor &color); 0029 void setSpacing(float spacing); 0030 void setLineWidth(float lineWidth); 0031 0032 bool isSubtreeBlocked() const override; 0033 0034 void update(); 0035 0036 private: 0037 void line(QSGGeometry::Point2D *vertices, quint16 *indices, int &index, qreal fromX, qreal fromY, qreal toX, qreal toY); 0038 0039 QSGGeometry *m_geometry = nullptr; 0040 QSGFlatColorMaterial *m_material = nullptr; 0041 0042 bool m_visible = true; 0043 bool m_vertical = false; 0044 QRectF m_rect; 0045 float m_spacing = 1.0; 0046 float m_lineWidth = 1.0; 0047 }; 0048 0049 #endif // LINEGRIDNODE_H