本页内容

QSGRectangleNode Class

QSGRectangleNode 类是一个用于通过场景图绘制实心矩形的便捷类。更多内容...

头文件: #include <QSGRectangleNode>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
继承自: QSGGeometryNode

公共函数

virtual ~QSGRectangleNode() override
virtual QColor color() const = 0
virtual QRectF rect() const = 0
virtual void setColor(const QColor &color) = 0
virtual void setRect(const QRectF &rect) = 0
void setRect(qreal x, qreal y, qreal w, qreal h)

详细说明

成员函数文档

[override virtual noexcept default] QSGRectangleNode::~QSGRectangleNode()

销毁QSGRectangleNode 的实例。该析构函数是虚函数。

[pure virtual] QColor QSGRectangleNode::color() const

返回该矩形的颜色。

另请参阅 setColor()。

[pure virtual] QRectF QSGRectangleNode::rect() const

返回该 rect 节点所覆盖的矩形。

另请参阅 setRect()。

[pure virtual] void QSGRectangleNode::setColor(const QColor &color)

将此矩形的颜色设置为color 。默认颜色为白色。

另请参阅 color()。

[pure virtual] void QSGRectangleNode::setRect(const QRectF &rect)

将此 rect 节点的矩形设置为rect 。

另请参阅 rect()。

void QSGRectangleNode::setRect(qreal x, qreal y, qreal w, qreal h)

将此 rect 节点的矩形起始点设置为 (x,y),宽度为w ,高度为h 。

这是一个重载函数。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.