QML动画的可见属性更改 [英] QML animations visible property changes

查看:393
本文介绍了QML动画的可见属性更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在元素可见时(要平滑显示,而不是全部显示)绘制动画

I want an animation to be painted when an element becomes visible (is should appear smoothly, not the whole at all)

我尝试过

states: State
{
    name: "iconOff"
    when: iconOnSwitch.checked == false
    PropertyChanges { target: selectIconRow; visible: false }
}

transitions: Transition
{
    reversible: true
    from: ""
    to: "iconOff"
    PropertyAnimation
    {
        properties: "x,y,visible"
        easing.type: Easing.InOutQuad
        from: selectIconRow
        property: "visible"
    }
}

但是selectIconRow仍会立即出现

But the selectIconRow still appears immediately

如何使用这样的动画?

推荐答案

因为它是布尔值, visible 属性不能设置动画。也许 opacity 可以解决问题。

Because it's boolean, visible property cannot be animated. Perhaps opacity could do the trick.

这篇关于QML动画的可见属性更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆