温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Qt信号入参使用QVariantList编译问题怎么解决

发布时间:2021-12-15 14:05:19 来源:亿速云 阅读:137 作者:iii 栏目:互联网科技

这篇文章主要讲解了“Qt信号入参使用QVariantList编译问题怎么解决”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Qt信号入参使用QVariantList编译问题怎么解决”吧!

编译错误出现一大堆,这里只贴了前面的一部分,来看下:


In file included from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qglobal.h:1173:0,                 from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qnamespace.h:43,                 from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qobjectdefs.h:48,                 from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include\QtCore/qobject.h:46,                 from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include\QtCore/QObject:1,                 from temp\moc\../../../test/module_function/test.h:4,                 from temp\moc\moc_test.cpp:9:D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qtypeinfo.h: In instantiation of 'class QTypeInfo<QVariant>':D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:459:31:   required from 'void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = QVariant]'D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:813:22:   required from 'QList<T>::QList(const QList<T>&) [with T = QVariant]'temp\moc\moc_test.cpp:103:82:   required from hereD:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qtypeinfo.h:67:26: error: invalid application of 'sizeof' to incomplete type 'QVariant'         isLarge = (sizeof(T)>sizeof(void*)),                          ^D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qtypeinfo.h:69:24: error: invalid application of 'sizeof' to incomplete type 'QVariant'         sizeOf = sizeof(T)                        ^In file included from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include\QtCore/qobject.h:49:0,                 from D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include\QtCore/QObject:1,                 from temp\moc\../../../test/module_function/test.h:4,                 from temp\moc\moc_test.cpp:9:D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h: In instantiation of 'void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = QVariant]':D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:813:22:   required from 'QList<T>::QList(const QList<T>&) [with T = QVariant]'temp\moc\moc_test.cpp:103:82:   required from hereD:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:462:28: error: invalid use of incomplete type 'class QVariant'

从错误里不太容易看出来错误原因和错误的代码位置,只能看到文件,是moc_test.cpp编译时引起的错误,可能和QVariant类型有关;

在代码中,没有使用QVariant类型的地方,使用QVariantLis的地方有两个,一个是信号的入参,一个是信号的入参,一个是函数的成员变量定义;我把这两个部分同时注释掉,发现编译可以通过了;单独注释掉信号定义,也可以编译过!这也是导致问题不好判断的地方。 

后来加上头文件

#include  <QVariantList>

然后就都可以编译通过了!

感谢各位的阅读,以上就是“Qt信号入参使用QVariantList编译问题怎么解决”的内容了,经过本文的学习后,相信大家对Qt信号入参使用QVariantList编译问题怎么解决这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI