• 2975阅读
  • 1回复

zhengtianzuo系列-Qml旋转箭头 [复制链接]

上一主题 下一主题
离线zhengtianzuo
 

只看楼主 倒序阅读 楼主  发表于: 2017-10-18
一个向右的箭头, 点击顺时针旋转90°, 再次点击逆时针旋转90°

```
Image {
        id: image
        height: 24
        width: 24
        anchors.centerIn: parent
        source: "qrc:/image.png"

        MouseArea{
            anchors.fill: parent
            onClicked:{
                if (rotationAnimation.running === true) return;
                rotationAnimation.start();
            }
        }
    }
    RotationAnimation{
        id: rotationAnimation
        target: image
        from: 0
        to: 90
        duration: 100
        onStopped: {
            if (isDown === true)
            {
                rotationAnimation.from = 0;
                rotationAnimation.to = 90;
            }
            else
            {
                rotationAnimation.from = 90;
                rotationAnimation.to = 0;
            }
            isDown = !isDown;
        }
    }
```



需要完整代码请访问 QtQuickExamples
博客地址: https://blog.csdn.net/zhengtianzuo06
Github: https://github.com/zhengtianzuo
个人产品: https://github.com/zhengtianzuo/Silk
产品网站: http://www.camelstudio.cn
离线big_mouse

只看该作者 1楼 发表于: 2020-04-22
快速回复
限100 字节
 
上一个 下一个