Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Accessing a SequentialAnimation from c++
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Accessing a SequentialAnimation from c++

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 611 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Katlin
    wrote on last edited by
    #1

    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++ ?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Katlin
      wrote on last edited by
      #2

      I've found the solution:

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved