qml_base

好久没有记笔记了,。。。

ClickedImage.qml

import QtQuick 2.5
Image {
    
    id: root
    signal clicked    //声明一个信号
  MouseArea{
   anchors.fill:parent
    oncCicked: root.clicked()  //绑定信号到 root


}    
}


TransformationExample.qml
Item{
    width: bg.width
    heigh: bg.height
image{
  id: bg
  source: ''assets/backgroud.png"
    
}
MouseArea{
id:backgroundClicker
anchors.fill: parent
onclicked:   //改变布局
{
   circle.x = 84
  box.rotation = 0
triangle.rotation = 0
triangle.scale = 1.0   //范围

_test_transformed()  
}
}    
ClickableImage {
 id:circle
x:84;y:68
source: "assets/circle_blue.png"
onClicked:
{
   x+=20  
}
}
ClickableImage
{
 id:box
x:164;y:68
source:"asser/triangle_red.png"
onClicked:{
rotation +=15
scale +=0.05

}
}
function _test_transformed()  //定义函数
{
   circle.x +=20
   box.rotation +=15
   triangle.rotation += -15  
}
}

 

posted @ 2019-07-11 18:53  countryboy666  阅读(90)  评论(0编辑  收藏  举报