[SOLVED] Accessing a SequentialAnimation from c++



  • Let's assume the following code:
    @
    //myAnimation.qml
    SequentialAnimation{
    property int delay;
    property int duration;
    }
    @
    @
    //main.qml
    Label{
    myAnimation{
    id:animation1
    objectName:'animation1'
    delay:10
    duration:13
    }
    }
    @
    @
    //Label.cpp
    void validateAnimationParameters(){
    // here I need to check if animation1.delay+animation1.duration<100
    }
    @

    How can I access those 2 properties of the animation from c++ ?



  • I've found the solution:

    @
    QObject a1 = this->findChild<QObject>("animation1");
    int delay = a1->property("delay").toInt();
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.