Thanks Guiseppe,

I try to come up with a solution based on your and Sean's answer.

Cheers Volker

Am 30/08/2017 um 11:29 schrieb Giuseppe D'Angelo:
Il 30/08/2017 10:07, Volker Enderlein ha scritto:
Entity {
      id: root

      property Transform frame: Transform {}
      property Material mat: PhongMaterial { diffuse: Qt.rgba(0.8, 0.8,
0.8, 1.0) }
...

}

Later I try to update the Transform and Material from C++. But I cannot
set the properties via qmlEntity->setProperty("Transform",
QVariant(Qt3DCore::QTransform)); because QTransform is not usable as
metatype.

The type of the property is QTransform*, not QTransform -- pass a pointer to your QTransform object to setProperty. (Also, the name of the property is "frame", not "Transform".)

IOW:

Qt3DCore::QTransform *t = ...;
entity->setProperty("frame", t);

How would I do that, or should I use an entirely different approach?

Another approach is exposing the QTransform to the QML engine (for instance via engine->setContextProperty("_myTransform", t)), then using _myTransform in QML:

Entity {
    components: [ _myTransform, ... ]
}


Hope this helps,


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


--
Volker Enderlein                         Institut für Mechatronik e.V.
Phone: +49 (0)371 531 19651              Reichenhainer Strasse 88
Fax:   +49 (0)371 531 19699              D-09126 Chemnitz
Mail: volker.enderl...@ifm-chemnitz.de   www.ifm-chemnitz.de

Vorstand:
Prof. Dr.-Ing. Welf-Guntram Drossel (Vorsitz)
Dipl.-Ing. Heiko Freudenberg (Geschäftsführer)

Amtsgericht Chemnitz VR 713
Ust.-IdNr. DE 159285348

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to