Qt Quick——QML基础(一)

  一个QML基本上有根元素和子元素组成

一、可视化元素(界面)

  1、Item基础元素对象

  2、Rectangle矩形框

    radius:8  //使用半径属性设定圆角矩形

  3、Text    

    text:"A very long text"
    clide:Text.ElideMiddle//文字无法全部显现时,中间省略。"A ver... text"
    style:Text.Sunken
    StyleColor:"#ff4444"//字体红色阴影

  4、Image

    fillMode:Image.PressverAspectCrop
    clip:true
    Behavor on rotation{
      NumberAnimation:250//动作花费时间250ms
    }
    image.rotation+=90//旋转90°

  5、MouseEvent鼠标区域  

二、非可视化元素

  Timer定时器

三、注意事项

1、属性绑定和赋值

  绑定:text:"my age is "+age;//存在与整个周期,随着age变化而变化

  赋值:label.text="hello world"//赋值,并且取消之前的绑定
      id.text

猜你喜欢

转载自www.cnblogs.com/wangbin-heng/p/9563033.html