Results 1 to 4 of 4

Thread: QMetaProperty::read: Unable to handle unregistered datatype 'QList<char>' for propert

  1. #1
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default QMetaProperty::read: Unable to handle unregistered datatype 'QList<char>' for propert

    The problem is that char is NOT "my" type. It is a key word in C and C++.
    I wrote this:

    Qt Code:
    1. Q_PROPERTY (QList<char> pointType READ pointType WRITE setPointType NOTIFY pointTypeChanged)
    To copy to clipboard, switch view to plain text mode 

    and I get that error when I access it in QML. Yes, I have used qmlRegisterType for registering my class in main.cpp.
    I have used other objects too like int and QList, but the error occurs only for char.

    When int works why doesn't char work?

  2. #2
    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: QMetaProperty::read: Unable to handle unregistered datatype 'QList<char>' for pro

    The type "QList of char" is not known to Qt's type system.

    Simply
    Qt Code:
    1. Q_DECLARE_METATYPE(QList<char>)
    To copy to clipboard, switch view to plain text mode 
    somewhere, e.g. the header of the class using that property.

    Cheers,
    _

  3. #3
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: QMetaProperty::read: Unable to handle unregistered datatype 'QList<char>' for pro

    Yes, that is obvious but I'd like to know the reasons. When int is registered why isn't char? They have QChar then why not QInt?

  4. #4
    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: QMetaProperty::read: Unable to handle unregistered datatype 'QList<char>' for pro

    Most likely because QList<int> was needed somewhere while QList<char> was not.

    QChar is not a Qt type for char as in the numerical value type, but to hold a single unicode text character, including conversion functions, etc. It could also be named QLetter.

    Cheers,
    _

Similar Threads

  1. QSA: unregistered datatype 'QObjectList' for property
    By mikefilonov in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2012, 08:33
  2. Replies: 4
    Last Post: 4th July 2012, 07:37
  3. Replies: 3
    Last Post: 18th May 2008, 18:36
  4. Unable to handle WindowStateChange events
    By TheRonin in forum Qt Programming
    Replies: 1
    Last Post: 6th March 2008, 11:20
  5. 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.