查看完整版本: [-- Cannot assign to non-existent property "button" --]

QTCN开发网 -> Qt QML开发 -> Cannot assign to non-existent property "button" [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

lsyzsl 2016-06-16 15:39

Cannot assign to non-existent property "button"

今天学习QML组件创建时,虽然是动手按照例子来写的,但是仍然报错。错误如下:

file:///D:/QML/com/main.qml:6:5: Cannot assign to non-existent property "button"
         button {
上网去搜索了下,没搜索到可用的信息,于是就看qt自带的文档。
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. This document is then automatically recognized by the engine as a definition of a QML type. Additionally, a type defined in this manner is automatically made available to other QML files within the same directory as the engine searches within the immediate directory when resolving QML type names.


哎,找来找去,答案就在qml帮助文档中。

马侬骑士 2016-06-17 15:58
就是自己创建组件的时候需要以大写开头,
不过对于loader对象,还有在main函数中加载的qml大小写无区别
为了防止这种错误一律命名为大写开头


查看完整版本: [-- Cannot assign to non-existent property "button" --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled