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