Introduction to the QML language

QML对象与属性详解
本文介绍了QML中对象的定义方式及属性命名规范,并详细解释了列表属性、分组属性和信号处理器的具体用法。此外,还通过实例展示了如何使用MouseArea组件处理鼠标事件。

 

Objects are specified by their type, followed by a pair of braces. Object types always begin with a capital letter.

Objects 类型都是大写开头。

 

Property naming
Properties begin with a lowercase letter (with the exception of Attached Properties).

全部小写开头,除了Attatched properties

 

List properties

Item {
    children: [
        Image {},
        Text {}
    ]
}

Grouped Properties

Attached Properties

可以参考wpf的附加属性:

XAML开发入门之附加属性和绑定属性

http://dev.yesky.com/msdn/112/2663612.shtml

 

Signal Handlers

All signal handlers begin with "on".

MouseArea {
    acceptedButtons: Qt.LeftButton | Qt.RightButton
    onPressed: if (mouse.button == Qt.RightButton) console.log("Right mouse button pressed")
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值