Important: Please read the Qt Code of Conduct -

[solved] How to fire off QML-animation from C++

  • I connected C++ and QML via a mediator-class and have everything working in both directions but this one puzzles me.

    This is how I connect the mediator-class:

    @ // Initialize Mediator between QML and C++
    QmlCppMediator m_qmlCppMediator;
    QDeclarativeContext *context = viewer.rootContext();
    context->setContextProperty("cppInterface", &m_qmlCppMediator);@

    How to fire off an ordinary Property-Animation from within C++ ?

  • Why not just create the property animation in QML and have the "running" property bound to something from the c++ world

  • That's a good idea. I went for an even cleaner approach now by binding the "state" of the object which I try to animate to a Q_PROPERTY in the C++ interface.

    The different states are linked to transitions (in QML) which do the animation I want.

Log in to reply