[Interest] Meta type automatic registration and QList in QML

Oleg Shparber trollixx at gmail.com
Mon Nov 19 01:35:35 CET 2012

Hi everyone,

I found that now new types in Q_PROPERTY should be registered automatically

In my application I need to pass QList<QRect> as an object property. Now I
use QVariantList because my code has been just ported from Qt4 to Qt5. I
have tried to use QList<QRect> instead of QVariantList but got the
following error:

 QMetaProperty::read: Unable to handle unregistered datatype 'QList<QRect>'
for property 'Article::rects'

Adding qRegisterMetaType<QList<QPoint>>("QList<QPoint>"); fixed the error
message but anyway I cannot iterate through a list or get its length. This
property shows like QVariant(QList<QRect>) in console.log().

Is there a way to handle QList<QRect> natively in Qt5's QML without awful
QVariantList wrapper?

Thanks in advance.

[1] https://codereview.qt-project.org/32897

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121119/785dac01/attachment.html>

More information about the Interest mailing list