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:
Code:
Q_PROPERTY (QList<char> pointType READ pointType WRITE setPointType NOTIFY pointTypeChanged)
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?
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
Code:
Q_DECLARE_METATYPE(QList<char>)
somewhere, e.g. the header of the class using that property.
Cheers,
_
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?
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,
_