QSGSimpleRectNode Class
QSGSimpleRectNode 类是一个便捷类,用于通过场景图绘制实心填充的矩形。更多内容...
| 头文件: | #include <QSGSimpleRectNode> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 继承自: | QSGGeometryNode |
公共函数
| QSGSimpleRectNode() | |
| QSGSimpleRectNode(const QRectF &rect, const QColor &color) | |
| QColor | color() const |
| QRectF | rect() const |
| void | setColor(const QColor &color) |
| void | setRect(const QRectF &rect) |
| void | setRect(qreal x, qreal y, qreal w, qreal h) |
详细说明
警告:此 实用类仅在与Qt Quick 场景图的默认后端或软件后端配合使用时才有效。作为替代方案,建议通过QQuickWindow::createRectangleNode()使用QSGRectangleNode 。不过,当通过子类化使用且应用程序确定不会涉及任何特殊的场景图后端时,此独立类仍然有用。
成员函数文档
QSGSimpleRectNode::QSGSimpleRectNode()
创建一个包含空矩形且颜色为白色的 QSGSimpleRectNode 实例。
QSGSimpleRectNode::QSGSimpleRectNode(const QRectF &rect, const QColor &color)
创建一个 QSGSimpleRectNode 实例,其范围为rect ,颜色为color 。
QColor QSGSimpleRectNode::color() const
返回该矩形的颜色。
另请参阅 setColor()。
QRectF QSGSimpleRectNode::rect() const
返回该 rect 节点所覆盖的矩形。
另请参阅 setRect()。
void QSGSimpleRectNode::setColor(const QColor &color)
将此矩形的颜色设置为color 。默认颜色为白色。
另请参阅 color()。
void QSGSimpleRectNode::setRect(const QRectF &rect)
将此 rect 节点的矩形设置为rect 。
另请参阅 rect()。
void QSGSimpleRectNode::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.