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. How I can quickly save QML animation to file?
QtWS25 Last Chance

How I can quickly save QML animation to file?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.1k Views
  • 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
    komar_rus
    wrote on last edited by
    #1

    I have the following QML:
    @
    import Qt 4.7

    Item {
    width: 500
    height: 500
    Text {
    id: idText1
    x: 100
    y: 100
    color: "red"
    text: "Hello word!"
    font.pixelSize: 40

        SequentialAnimation {
            running: true
            NumberAnimation {target: idText1; properties: "x"; to: 0; duration:   1000 } 
            PauseAnimation {duration: 1000 }
            NumberAnimation {target: idText1; properties: "x"; to: 100;    duration: 1000 }
        }
    }
    

    }
    @

    The animation time is 3 seconds, but I want to save the result of anymation faster than 3 second, literaly saying I want it to be saved as fast as my processor can render it.

    That is what is desired:

    @
    QGraphicsScene scene;
    QDeclarativeEngine engine;
    QDeclarativeComponent component(&engine, QUrl::fromLocalFile("QMLTest.qml"));
    QGraphicsItem *pobject = qobject_cast<QGraphicsItem *>(component.create());
    scene.addItem(pobject);

    //My Code
    scene.SetFrameRate(25.0);
    //

    for (int n = 0; n < 75; n++)
    {
    QImage qImage(500, 500, QImage::Format_ARGB32);
    QPainter qPainter(&qImage);
    scene.render(&qPainter);

    //My Code
    qAVIFileWriter.WriteImage(qImage);
    //
    }

    veiw.show();
    @

    [edit: Mark up code, Tobias Hunger]

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      "This answer":http://developer.qt.nokia.com/forums/viewthread/1181/#5150 might be useful here are well.

      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