首页 > 其他 > 详细

qml_status笔记

时间:2020-02-26 10:00:25      阅读:64      评论:0      收藏:0      [点我收藏+]
import QtQuick 2.5
import QtQuick.Window 2.2
/*组件发出信号:
定义一个引用引用内部元素到外部: property alias cellColor: rectangle.color
定义信号: signal clicked(color cellCollr)
onClicked: clikcked(cellColor.color)*/
Window {
    visible: true
    width: 640
    height: 480

    Text{
    id: helloText
    text: "Helloworld"
    y: 30
    anchors.horizontalCenter: parent.horizontalCenter
    font.pointSize: 24
    MouseArea{
    id:mouseArea
    anchors.fill: parent

    }
    states: State{

    name: "down"; when: mouseArea.pressed === true
    PropertyChanges { //属性改变
        target:helloText;
        y:160;rotation:180  // 旋转
        color:"red"

    }

    }

    transitions: Transition{  // 过度
      from: ""; to: "down";reversible: true //可逆的 还原原来状态
      ParallelAnimation{ //平行的 动画
      NumberAnimation{property: "y,rotation";duration: 500; easing.type: Easing.InOutQuad} //放松

      ColorAnimation {duration: 500      }
      }
    }
    }
}

qml_status笔记

原文:https://www.cnblogs.com/countryboy666/p/12365011.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!