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

René Hansen renehh at gmail.com
Wed Aug 30 10:40:58 CEST 2017


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> 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
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170830/4f6bf776/attachment.html>


More information about the Interest mailing list