QSGOpacityNode Class
QSGOpacityNode 类用于更改节点的不透明度。更多内容...
| 头文件: | #include <QSGOpacityNode> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 继承自: | QSGNode |
- 所有成员列表(包括继承的成员)
- QSGOpacityNode 属于Qt Quick 场景图节点类。
公共函数
| QSGOpacityNode() | |
| virtual | ~QSGOpacityNode() override |
| qreal | opacity() const |
| void | setOpacity(qreal opacity) |
详细描述
不透明度适用于其子树,并且可以嵌套。多个不透明度节点的值将通过乘法累加。该累加操作作为渲染过程的一部分进行。
当嵌套的不透明度低于某个阈值时,子树可能会被标记为“被阻塞”,导致isSubtreeBlocked() 返回 true。这样做是为了提高性能。
注意:所有 以 QSG 为前缀的类应仅在场景图的渲染线程上使用。有关更多信息,请参阅“场景图与渲染”。
成员函数文档
QSGOpacityNode::QSGOpacityNode()
创建一个不透明度节点,其默认不透明度为 1。
不透明度在场景图中自上而下累加,因此如果一个节点上方有两个 QSGOpacityNode 实例,且它们的不透明度均为 0.5,则该节点的有效不透明度将为 0.25。
节点的默认不透明度为 1。
[override virtual noexcept] QSGOpacityNode::~QSGOpacityNode()
删除不透明度节点。
qreal QSGOpacityNode::opacity() const
返回此不透明度节点的透明度。
另请参阅 setOpacity()。
void QSGOpacityNode::setOpacity(qreal opacity)
将该节点的不透明度设置为opacity 。
在渲染图表之前,渲染器会对子树执行一次更新迭代,将不透明度传播到其子节点。
该值将被限制在 0 到 1 的范围内。
另请参阅 opacity()。
© 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.