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

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


Thanks René,

I tried that already (but unfortunately didn't mention it), but 
Qt3DCore::QTransform is derived from QNode and therefore implicitly from 
QObject so it is missing the copy constructor that is needed for the 
registration as metatype.

Cheers Volker

Am 30/08/2017 um 10:40 schrieb René Hansen:
> Try to register Qt3DCore::QTransform as a metatype in your main():
>
> qRegisterMetaType<Qt3DCore::QTransform>("Qt3DCore::QTransform");
>
> http://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType
>
> On Wed, 30 Aug 2017 at 10:16 Volker Enderlein 
> <volker.enderlein at ifm-chemnitz.de 
> <mailto:volker.enderlein at ifm-chemnitz.de>> wrote:
>
>     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
>
>
>     --
>
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at 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.enderlein at 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




More information about the Interest mailing list