分类: C/C++
2012-06-27 21:52:56
Any C++ data that is used from QML - whether as custom properties, or parameters for signals or functions - must be of a type that is recognizable by QML.
By default, QML recognizes the following data types:
To allow a custom C++ type to be created or used in QML, the C++ class must be registered as a QML type using(), as shown in the section above.
=====================================================================================================真烦人,Nokia是骗纸,最后又看见文档一个关于QML的property所支持的类型===================================================================================================== Supported property typesAll QML properties are typed. The examples above show properties with int and string types; notice that the type of the property must be declared. The type is used to determine the property behavior, and how the property is defined in C++.
A number of property types are supported by default. These are listed in the table below, with their default values and the corresponding C++ type:
QML Type Name | Default value | C++ Type Name |
---|---|---|
0 | int | |
false | bool | |
0.0 | double | |
0.0 | double | |
"" (empty string) | ||
"" (empty url) | ||
#000000 (black) | ||
undefined | ||
undefined |