[Interest] Qt3D/QML How to access a QTransform based property from C++

Volker Enderlein volker.enderlein at ifm-chemnitz.de
Wed Aug 30 10:07:08 CEST 2017


Hi all,

for an animation system I try to construct some parameterized QML 
components that provide access to their transformation and material via 
properties. The QML part looks the following way:

import Qt3D.Core 2.0
import Qt3D.Render 2.0
import QtQuick 2.0
import Qt3D.Extras 2.0

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.

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


Cheers Volker


-- 




More information about the Interest mailing list