Compile bug porting fromQt4 to Qt5
-
Hi SGaist.
Thank you for the reply. Yes, it was not in the offending moc file, but I do see that I make use of a QList<QByteArray>. I guess I have to register this type, but not sure how as of yet. Any hints ?
Thanks again
David -
Use "Q_DECLARE_METATYPE":http://qt-project.org/doc/qt-5.0/qtcore/qmetatype.html#Q_DECLARE_METATYPE and "qRegisterMetatype":http://qt-project.org/doc/qt-5.0/qtcore/qmetatype.html#qRegisterMetaType and you should be good
-
Ok, will give it a try when the work day ends. I really apprciate you taking the time to help here.
-
Hi,
I'm having this exact same problem too.
I'm also using QList<QByteArray> in my code, but not as a parameter to any signal or slot.
Can you please explain what the problem with QList<QByteArray> is and how can I fix this?Edit: I just looked at my compile output and I think the problem on my side is actually in these 2 lines:
......\Tools\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qmetatype.h: In instantiation of 'int qMetaTypeId(T*) [with T = QList<TRSite*>]':
......\Tools\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qmetatype.h:656:29: required from 'int qRegisterMetaType(T) [with T = QList<TRSite*>*]'I have in my mainwindow.h the following:
QList<TRSite*> list[10];But I have no idea why it is not compiling. Any suggestions what should I do?
-
Hi, in which case your QList<TRSite*> list is used? QVariant/ Property/ signal and slots?
If so, you should use Q_DECLARE_METATYPE and qRegisterMetatype to declare and register it.
-
Hi SGaist
I am also facing the same issue too.@In file included from moc_ThreadController.cpp:9:0:
../TestCartetionProduct/ThreadController.h:52:30: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
In file included from ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qobject.h:55:0,
from ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/QObject:1,
from ../TestCartetionProduct/ThreadController.h:4,
from moc_ThreadController.cpp:9:
../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qmetatype.h: In instantiation of 'int qMetaTypeId(T*) [with T = QVector<BaseMassSpectrumDTO*>]':
../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qmetatype.h:656:29: required from 'int qRegisterMetaType(T) [with T = QVector<BaseMassSpectrumDTO*>*]'
moc_ThreadController.cpp:96:102: required from here
../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qmetatype.h:642:5: error: invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure<false>'
make: *** [moc_ThreadController.o] Error 1
22:00:07: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project TestCartetionProduct (kit: Desktop Qt 5.0.2 GCC 64bit)
When executing step 'Make'@I am not able to follow up documentation of Q_DECLARE_METATYPE [qt-project.org] and qRegisterMetatype [qt-project.org].
- May you give a small example of how to use them or refer some link where any example is given.
Thanks
Manoj -
Hi,
Here's an "example from the documentation":http://qt-project.org/doc/qt-5/custom-types.html
[edit: corrected link for latest current documentation: 5.3]
-
Thanks SGaist, Its worked for me :)
This link also helped me to understand how to use signal/slot with the container classes and multi-threading "Queued Custom Type Example ":http://qt-project.org/doc/qt-5.0/qtcore/queuedcustomtype.html -
This is a broken link.
[quote author="SGaist" date="1377550906"]Hi,
Here's an "example from the documentation":http://qt-project.org/doc/qt-5.0/qtcore/tools-customtype.html[/quote]
-
Thanks, the link has been updated