1

QML StackViewStatus.Inactive状态是否意味着当视图进入此状态时,它的可见性被隐式设置为 false?因此,出于性能原因,我不需要将视图的可见性显式设置为 false 吗?

4

1 回答 1

1

您可以通过将以下内容添加到 中的项目来进行验证StackView

onVisibleChanged: print(visible)

查看代码,似乎它们确实是隐藏的:

/*! \internal */
function animationFinished()
{
    if (!__currentTransition || __currentTransition.animation.running)
        return

    __currentTransition.animation.runningChanged.disconnect(animationFinished)
    __currentTransition.exitItem.visible = false
    __setStatus(__currentTransition.exitItem, Stack.Inactive);
    __setStatus(__currentTransition.enterItem, Stack.Active);
    __currentTransition.properties.animation = __currentTransition.animation
    root.delegate.transitionFinished(__currentTransition.properties)

    if (!__currentTransition.push || __currentTransition.replace)
        __cleanup(__currentTransition.outElement)

    __currentTransition = null
}
于 2016-05-09T08:51:54.190 回答