Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt 配置+;=qmltypes_Qt_Cmake - Fatal编程技术网

Qt 配置+;=qmltypes

Qt 配置+;=qmltypes,qt,cmake,Qt,Cmake,链接说明如何在5.15中注册qml组件。我需要补充一点 CONFIG += qmltypes 到我的.pro文件,但我使用的是cmake,没有找到一种方法 可能是什么?如果您查看您链接的博客文章中的评论,您会看到有人询问如何将新的QML类型注册方法用于CMake,作者回答: CMake projects will be supported with Qt6. 我想你需要使用CMake的旧注册方式 qmlRegisterType<Person>("People"

链接说明如何在5.15中注册qml组件。我需要补充一点

CONFIG += qmltypes 
到我的.pro文件,但我使用的是cmake,没有找到一种方法


可能是什么?

如果您查看您链接的博客文章中的评论,您会看到有人询问如何将新的QML类型注册方法用于
CMake
,作者回答:

CMake projects will be supported with Qt6.
我想你需要使用CMake的旧注册方式

qmlRegisterType<Person>("People", 1,0, "Person");
qmlRegisterType(“人”,1,0,“人”);