Search code examples
qmlqt5stackview

QML StackView Status.Inactive


Does QML StackView Status.Inactivestatus mean that when a view enters this state it's visibility is set to false implicitly? So I don't need to set the view's visibility to false explicitly for performance reasons?


Solution

  • You could verify by adding the following to an item within the StackView:

    onVisibleChanged: print(visible)
    

    Looking at the code, it seems that they are indeed hidden:

    /*! \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
    }