Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgsimplerectnode.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qsgsimplerectnode.h"
6
8
30 : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
31{
32 Q_UNUSED(reserved);
34 m_material.setColor(color);
35 setMaterial(&m_material);
36 setGeometry(&m_geometry);
37}
38
39
40
46 : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
47{
49 setMaterial(&m_material);
50 setGeometry(&m_geometry);
51}
52
53
54
63
64
77{
78 const QSGGeometry::Point2D *pts = m_geometry.vertexDataAsPoint2D();
79 return QRectF(pts[0].x,
80 pts[0].y,
81 pts[3].x - pts[0].x,
82 pts[3].y - pts[0].y);
83}
84
85
91{
92 if (color != m_material.color()) {
93 m_material.setColor(color);
95 }
96}
97
98
99
104{
105 return m_material.color();
106}
107
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore\reentrant
Definition qrect.h:484
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
Definition qsgnode.cpp:764
void setColor(const QColor &color)
Sets this flat color material's color to color.
const QColor & color() const
Returns this flat color material's color.
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:927
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
static void updateRectGeometry(QSGGeometry *g, const QRectF &rect)
Updates the geometry g with the coordinates in rect.
Point2D * vertexDataAsPoint2D()
Convenience function to access the vertex data as a mutable array of QSGGeometry::Point2D.
@ DirtyMaterial
Definition qsgnode.h:75
@ DirtyGeometry
Definition qsgnode.h:74
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:624
QRectF rect() const
Returns the rectangle that this rect node covers.
void setColor(const QColor &color)
Sets the color of this rectangle to color.
void setRect(const QRectF &rect)
Sets the rectangle of this rect node to rect.
QSGSimpleRectNode()
Constructs a QSGSimpleRectNode instance with an empty rectangle and white color.
QColor color() const
Returns the color of this rectangle.
rect
[4]
Combined button and popup list for selecting options.
GLint GLint GLint GLint GLint x
[0]
GLuint color
[2]
GLint y
#define Q_UNUSED(x)
The QSGGeometry::Point2D struct is a convenience struct for accessing 2D Points.
Definition qsggeometry.h:79