Results 1 to 5 of 5

Thread: QMetaProperty::read: Unable to handle unregistered datatype in plugins

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QMetaProperty::read: Unable to handle unregistered datatype in plugins

    I'm also trying to do the same thing. In my case, my custom plugin has a simple struct property with several double members: struct Foo { double a; double b; double c; }; I've tried both Q_DECLARE_METATYPE and qRegisterMetaType but I still get the unregistered type error when I run designer. Was there ever a solution given for this? When should I be calling qRegisterMetaType? I'm calling it in my plugin's constructor for lack of better place I could think of.

  2. #2
    Join Date
    Jun 2012
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Lightbulb Re: QMetaProperty::read: Unable to handle unregistered datatype in plugins

    Hi,

    I've tried both Q_DECLARE_METATYPE and qRegisterMetaType but I still get the unregistered type error
    I had the same problem and was searching for a solution for days. In my case the data type is defined in a namespace (lets say MyNamespace) and i used the Q_PROPERTY macro as it is mentioned in the docs. The thing is that it is not mentioned that you must fully qualify your data type when using this macro.

    So this line is wrong, although the compiler won't warn you or something:

    Qt Code:
    1. Q_PROPERTY(MyClass customProperty READ getCustomProperty WRITE getCustomProperty)
    To copy to clipboard, switch view to plain text mode 

    ...but this line is correct:

    Qt Code:
    1. Q_PROPERTY(MyNamespace::MyClass customProperty READ getCustomProperty WRITE getCustomProperty)
    To copy to clipboard, switch view to plain text mode 

    The message "QMetaProperty::read: Unable to handle unregistered datatype" comes from QMetaProperty::read() and this is the place where one should start to debug when this message appears. Here you can clearly see which QVariant or QMetaType call is returning wrong data.

    When should I be calling qRegisterMetaType?
    Thats easy to answer as it is mentioned on the docs, have a look at:

    http://doc.qt.nokia.com/4.7-snapshot...sterMetaType-2

    Also, to use type T with the QObject::property() API, qRegisterMetaType<T>() must be called before it is used, typically in the constructor of the class that uses T, or in the main() function.
    Hope this helps.

    So long
    Daniel

Similar Threads

  1. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  2. Replies: 3
    Last Post: 18th May 2008, 18:36
  3. Replies: 17
    Last Post: 8th February 2007, 16:30

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
  •  
Qt is a trademark of The Qt Company.