File: LineGridNode.h

package info (click to toggle)
kf6-kquickcharts 6.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 852 kB
  • sloc: cpp: 5,663; makefile: 11; sh: 5
file content (49 lines) | stat: -rw-r--r-- 1,128 bytes parent folder | download | duplicates (5)
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