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
    Dec 2008
    Location
    Cali, Colombia
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

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

    Hello, I have this problem.

    I define an typedef of qreal as Real and make it available to QVariant with Q_DECLARE_METATYPE in an include file, lets say "typedefs.h"

    Then create an abstract interface with:
    Q_PROPERTY( Real nextReal READ nextReal )

    Define then the Subclass and implement "nextReal" method. Create a plugin that create the subclass.

    In the main.cpp of the application load the plugin, create a Subclass object and read the property using QObject:roperty and get this message:

    QMetaProperty::read: Unable to handle unregistered datatype 'Real' for property 'AbstractInterface::nextReal'

    but if it is readed with nextReal method works fine.

    in both files main.cpp and AbstractInterface.h include typedefs.h

    I need to use the QObject interface not the Abstract interface, how can I solve this?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

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

    Have you tried qRegisterMetaType()?
    J-P Nurmi

  3. #3
    Join Date
    Dec 2008
    Location
    Cali, Colombia
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

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

    Yes, I have tried that, but when I print the result, it prints "0", not the real value, since the method returns non-zero reals. Any other ideas?

  4. #4
    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.

  5. #5
    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.