PDA

View Full Version : Qt5: QMetaType error



Ginsengelf
21st December 2012, 12:33
Hi, I'm trying to build an existing Qt4 project with Qt5. After several problems with changed headers and renamed functions my source files compile, but the moc_xxx.cpp files generate errors:

1>c:\qt\5.0.0\5.0.0\msvc2010\include\QtCore/qmetatype.h(642): error C2338: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system
1> c:\qt\5.0.0\5.0.0\msvc2010\include\QtCore/qmetatype.h(656): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "int qMetaTypeId<T>(T *)".
1> with
1> [
1> T=QVector<QPointF> *
1> ]
The german message in the middle means something like "see reference to instantiation of the just compiled function template".
I have a slot that takes QVector<QPointF>* as a parameter (among others), and it worked without problems in Qt4. I tried to use various combinations of QVector and QPointF with Q_DECLARE_METATYPE, but the error still exists. I'm using VisualStudio 2010 Express.

Ginsengelf

amleto
21st December 2012, 13:50
I tried to use various combinations of QVector and QPointF with Q_DECLARE_METATYPE, but the error still exists
Right, but we don't know what you tried and what the outcomes were (if there were any differences). Please show with code what you did, preferably compilable examples (see my sig.).

anda_skoa
21st December 2012, 17:54
probably missing


qRegisterMetaType<QVector<QPointF> >();


Cheers,
_

amleto
21st December 2012, 23:49
I can't remember if that is correct or if you need to add the * ...


qRegisterMetaType<QVector<QPointF>* >("QVector<QPointF>*");

anda_skoa
22nd December 2012, 09:43
No, you are right. I misread the posting, I though the type was QVector<QPointF>. It is indeed a pointer of that.

Cheers,
_