• 4771阅读
  • 1回复

Cannot assign to non-existent property "button" [复制链接]

上一主题 下一主题
离线lsyzsl
 

只看楼主 倒序阅读 楼主  发表于: 2016-06-16
今天学习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帮助文档中。
离线马侬骑士

只看该作者 1楼 发表于: 2016-06-17
就是自己创建组件的时候需要以大写开头,
不过对于loader对象,还有在main函数中加载的qml大小写无区别
为了防止这种错误一律命名为大写开头
快速回复
限100 字节
 
上一个 下一个