Results 1 to 5 of 5

Thread: Qt5: QMetaType error

  1. #1
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    511
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Qt5: QMetaType error

    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:
    Qt Code:
    1. 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
    2. 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 *)".
    3. 1> with
    4. 1> [
    5. 1> T=QVector<QPointF> *
    6. 1> ]
    To copy to clipboard, switch view to plain text mode 
    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

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt5: QMetaType error

    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.).
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt5: QMetaType error

    probably missing
    Qt Code:
    1. qRegisterMetaType<QVector<QPointF> >();
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt5: QMetaType error

    I can't remember if that is correct or if you need to add the * ...

    Qt Code:
    1. qRegisterMetaType<QVector<QPointF>* >("QVector<QPointF>*");
    To copy to clipboard, switch view to plain text mode 
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt5: QMetaType error

    No, you are right. I misread the posting, I though the type was QVector<QPointF>. It is indeed a pointer of that.

    Cheers,
    _

Similar Threads

  1. Please help out with this qmetatype.h error
    By rickrvo in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 2nd August 2011, 18:53
  2. Trouble using custom datatype (QMetaType) in QtTest
    By perden in forum Qt Programming
    Replies: 6
    Last Post: 2nd September 2009, 15:26
  3. QListView drag error with qmetatype
    By baray98 in forum Qt Programming
    Replies: 8
    Last Post: 29th June 2009, 08:12
  4. Registering classe in QMetaType
    By rcintra in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2007, 22:26
  5. QMetaType usage
    By ian in forum Qt Programming
    Replies: 4
    Last Post: 22nd December 2006, 01:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.