C

Qt Cluster: Rendering and Recovery from Main UI Failure

// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

// This file is part of the Qt Safe Renderer module

#ifndef GAUGENODE_H
#define GAUGENODE_H

#include <QSGNode>
#include <QColor>

class GaugeNode : public QSGGeometryNode
{
public:
    GaugeNode(const int &numVertices, const QColor &color, const bool &doNotFill);
    ~GaugeNode();

    void setColor(const QColor &color);
    void setCutRad(const float &cutRad);

    void setDoNotFill(const bool &doNotFill);

    void setBackCutRad(const double &backCutRad);
    void setRadius(const double &radius);
    void setArcDistPerVert(const double &dist);
    void setNumVertices(const int &numVertices);

    void setFillWidth(const double &fillWidth);
    void setBoundingRect(const QRectF &rect);

    void setLeftToRight(const bool &ltr);

    void draw();

private:
    void initGeometry();
    void setCenterPoint(const QPointF &center);

    void drawGeometry();
    void drawGeometryTexturePoint2D();
    void drawMaterial();

private:
    QSGGeometry m_geometry;
    QSGMaterial *m_material;
    int m_numVertices;
    bool m_doNotFill;
    QColor m_color;
    float m_cutRad;
    double m_radius;
    bool m_lefttoright;

    qreal m_width;
    qreal m_height;
    double m_center_y;
    double m_center_x;
    double m_backCutRad;
    double m_fillWidth;
    double m_arc_dist_per_vertices;

    DirtyState m_dirtyBits;
};

#endif // GAUGENODE_H