How I can quickly save QML animation to file?
-
I have the following QML:
@
import Qt 4.7Item {
width: 500
height: 500
Text {
id: idText1
x: 100
y: 100
color: "red"
text: "Hello word!"
font.pixelSize: 40SequentialAnimation { 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]
-
"This answer":http://developer.qt.nokia.com/forums/viewthread/1181/#5150 might be useful here are well.