前言

今天写一个自定义AreaSeries的qml,在编写的时候需要在里面添加一个QtObject的成员。运行后提示“Cannot assign to no-existent property ”的提示。

//BJAreaSeries.qml
import QtQuick 2.0
import QtCharts 2.14AreaSeries {lowerSeries: LineSeries{}upperSeries: LineSeries{}QtObject{}
}
//main.qml
import QtQuick 2.12
import QtQuick.Window 2.12
import QtCharts 2.14Rectangle {visible: truewidth: 640height: 480ChartView {anchors.fill: parenttheme: ChartView.ChartThemeBrownSandantialiasing: trueValueAxis{id:id_axisXmin: 0max: 1000}ValueAxis{id:id_axisYmin: 0max: 100}BJAreaSeries{axisX: id_axisXaxisY: id_axisY}}
}

解决方法

既然提示"无法分配给不存在的默认属性",那我们直接添加属性并赋默认值,如下:

    property var myobj: QtObject{}

问题解决!

Qml 的“Cannot assign to no-existent property “错误。相关推荐

  1. Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#Object‘的解决方法...

    发现问题 运行一下以前的一个Vue+webpack的 vue仿新闻网站  小项目,报错 由于自己vue学习不深入,老是这个报错,找了好久(确切的说是整整一下午^...^)才找到原因 -v- Uncau ...

  2. Cannot assign to read only property 'exports' of object '#Object'

    在webpack项目中使用@babel/plugin-transform-runtime时,报错 ERROR in Error: E:\workdata\webpackVue/node_modules ...

  3. Vue报错:Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object 的解决方法

    Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法 参考文章: (1)Vue ...

  4. Cannot assign to read only property ‘0’ of string的报错原因之一及解决办法

    一. 需求场景 现有项目,需要对提交资料的人员进行审核,审核不过的时候向服务器提交数据,数据结构中的certificationStatus需为JSON格式 1.1 资料信息结构如下: auditFai ...

  5. mappedBy reference an unknown target entity property 错误 @ManyToMany(mappedBy @OneToMany(mappedBy

    mappedBy reference an unknown target entity property 错误 @ManyToMany(mappedBy = @OneToMany (mappedBy ...

  6. Accessing non existent property lineno of module

    hexo部署遇到的问题 问题描述 Accessing non-existent property 'lineno' of module exports inside circular dependen ...

  7. Eclipse下的Setting property 'source' to '...' did not find a matching property 错误

    Eclipse下运行服务器时报警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context}Setting property 'source' ...

  8. iBatis报java.lang.RuntimeException: Error setting property错误

    通过检查,发现数据库中此列数据为空,但实际数据库设置此字段属性为int类型,默认值为0,当查询转换时,不能把null转换成int类型,如此就产生了异常,如果实际应用中确实有空的数据,但需转换成其他类型 ...

  9. Objective-c的@property 详解

    之前很多网友对我翻译的教程中的Property的使用感到有些迷惑不解,搞不清楚什么时候要release,什么时候要self.xxx = nil;同时对于Objective-c的内存管理以及cocos2 ...

最新文章

  1. 手机qq协议做的第三方qq软件
  2. python字符串27种常见的方法
  3. C#-利用Marshal类实现序列化
  4. 漫画:图的 “最短路径” 问题 | 技术头条
  5. 互联网日报 | 3月2日 星期二 | ​互联网人薪资报告:2021 开年薪资环比增长 7%...
  6. maven 打包部署时访问远程仓库中没有的jar
  7. MTK 驱动(69)---MTK平台 电池驱动相关
  8. 那位 13 岁就当上老板的开发者是如何炼成的?
  9. 所有C#程序员必须知道的13件事
  10. Python与Redis集群的交互
  11. 聊聊flink的KvStateRegistryGateway
  12. Mybatis 延迟加载策略
  13. 【元胞自动机】基于matlab元胞自动机短消息网络病毒传播仿真【含Matlab源码 1289期】
  14. mysql 主从同步 错误_MySQL 主从同步错误(error)解决
  15. 游戏编程之路 -- 《Windows游戏编程大师技巧》第一章 笔记
  16. quicktime ogv_Windows的QuickTime已死,应卸载以确保安全
  17. 关于iphone备份在c盘之后无法恢复备份的问题
  18. 摄影曝光基础——光圈、快门、ISO
  19. 计算机管理 超级用户,Win10如何开启Administrator超级管理员帐户?
  20. 9月7日冬瓜哥与你见面畅谈!

热门文章

  1. 一文搞懂基础数据单位换算逻辑
  2. 美国SAP高手跳槽记-转自George
  3. matlab中legend字体大小设置(一)
  4. 纯CSS3制作皮卡丘动画壁纸
  5. Execl/WPS匹配赋值VLOOKUP函数
  6. 锤子android 7,锤子坚果Pro 2工信部入网:TFT显示屏,Android 7.1.1
  7. jQuery中replaceWith()方法与unwarp()方法
  8. 荣耀华为手机卡在激活设备无法激活应该怎么刷机平台工具软件固件资料驱动使用方法说明
  9. html抽奖圆盘,求一个可挑概率的html5抽奖 圆盘的
  10. Windows7 C盘瘦身最有效的方法