本文介绍了是“var"吗?和“变体"同样的事情?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
据我所知,要在 QML 中使属性成为数组,您必须将其指定为 variant
或 var
类型:
From what I understand, to make a property an array in QML you must specify it as the type variant
or var
:
property var myArray:[]
这似乎与以下内容完全相同:
And this appears to be exactly the same as:
属性变量 myArray:[]
这是真的吗?
推荐答案
根据 Qt 5.0 变体文档:
变体类型是通用属性类型.它已过时,仅用于支持旧应用程序;新应用程序应该使用 var 类型属性.>
所以是的,它是一样的,但你应该始终坚持使用 var
(除非你有一个不支持的早期版本).
So yes, it is the same, but you should always stick to var
(unless you got an earlier version which does not support that yet).
这篇关于是“var"吗?和“变体"同样的事情?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!