QSGOpacityNode 类

QSGOpacityNode 类用于改变节点的不透明度。 更多...

头: #include <QSGOpacityNode>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
继承: QSGNode

公共函数

QSGOpacityNode ()
virtual ~QSGOpacityNode () override
qreal opacity () const
void setOpacity (qreal opacity )

详细描述

Opacity applies to its subtree and can be nested. Multiple opacity nodes will be accumulated by multiplying their opacity. The accumulation happens as part of the rendering.

When nested opacity gets below a certain threshold, the subtree might be marked as blocked, causing isSubtreeBlocked () to return true. This is done for performance reasons.

注意: 所有带有 QSG 前缀的类只应用于场景图形渲染线程。见 场景图形和渲染 了解更多信息。

成员函数文档编制

QSGOpacityNode:: QSGOpacityNode ()

Constructs an opacity node with a default opacity of 1.

Opacity accumulates downwards in the scene graph so a node with two QSGOpacityNode instances above it, both with opacity of 0.5, will have effective opacity of 0.25.

节点的默认不透明度为 1。

[override virtual noexcept] QSGOpacityNode:: ~QSGOpacityNode ()

删除不透明度节点。

qreal QSGOpacityNode:: opacity () const

返回此不透明度节点的不透明度。

另请参阅 setOpacity ().

void QSGOpacityNode:: setOpacity ( qreal opacity )

Sets the opacity of this node to opacity .

Before rendering the graph, the renderer will do an update pass over the subtree to propagate the opacity to its children.

The value will be bounded to the range 0 to 1.

另请参阅 opacity ().