大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章主要讲解了“Qt信号入参使用QVariantList编译问题怎么解决”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Qt信号入参使用QVariantList编译问题怎么解决”吧!
崇左ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!
编译错误出现一大堆,这里只贴了前面的一部分,来看下:
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
': D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:459:31: required from 'void QList
::node_copy(QList ::Node*, QList ::Node*, QList ::Node*) [with T = QVariant]' D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:813:22: required from 'QList
::QList(const QList &) [with T = QVariant]' temp\moc\moc_test.cpp:103:82: required from here
D:\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
::node_copy(QList ::Node*, QList ::Node*, QList ::Node*) [with T = QVariant]': D:\Qt\Qt5.10.0\5.10.0\mingw53_32\include/QtCore/qlist.h:813:22: required from 'QList
::QList(const QList &) [with T = QVariant]' temp\moc\moc_test.cpp:103:82: required from here
D:\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
然后就都可以编译通过了!
感谢各位的阅读,以上就是“Qt信号入参使用QVariantList编译问题怎么解决”的内容了,经过本文的学习后,相信大家对Qt信号入参使用QVariantList编译问题怎么解决这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!