qml坑之invalid property name

新建一个qml文件,定义一个控件,但是在main.qml中调用报错:invalid property name
原因:调用时的对象名称首字母必须大写

Defining Object Types through QML Documents

“To create an object type, a QML document should be placed into a text file named as TypeName.qml where TypeName is the desired name of the type, which must be comprised of alphanumeric characters or underscores and beginning with an uppercase letter. “

而对象id和对象属性(property)命名首字母必须为小写字母

A value may be assigned to the id attribute of an object instance to allow that object to be identified and referred to by other objects. This id must begin with a lower-case letter or an underscore, and cannot contain characters other than letters, numbers and underscores.

Property names must begin with a lower case letter and can only contain letters, numbers and underscores.

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值