Статус QML StackView. Неактивен

Означает ли QML StackView Status.Inactivestatus, что когда представление входит в это состояние, его видимость неявно устанавливается в false? Так что мне не нужно явно устанавливать видимость представления в false из соображений производительности?


person Silex    schedule 09.05.2016    source источник


Ответы (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
}
person Mitch    schedule 09.05.2016
comment
Спасибо @Mitch за подтверждение! Часть кода говорит сама за себя. Хотя распечатать переменную тоже было хорошей идеей, стоило подумать об этом. - person Silex; 09.05.2016