[Interest] getting type information of properties in QML

Federico Ferri federico.ferri.it at gmail.com
Tue Jul 16 12:10:03 CEST 2024


Is there any way to get type information about types of properties defined
in a QML Component?

e.g.

Item {
    property color c
    property vector3d v
    property int i

    Component.onCompleted: {
        getPropertyType(c) === 'color'
        getPropertyType(v) === 'vector3d'
        getPropertyType(i) === 'int'
    }
}

Details on my usecase: I receive messages over network that decode to JS
objects, but values such as colors and 3d vectors are encoded as simple JS
arrays (e.g. [0.0, 0.5, 1.0]) and direct assignment to the above properties
won't work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240716/120012f8/attachment.htm>


More information about the Interest mailing list