How to do it...

To learn how to render animation in QML, follow this example:

  1. Create a Qt Quick Application - Empty project. Then, right-click on the Resources icon under our project panel and add tux.png into our project's resource:
  1. Open up main.qml and change the window size to 650 x 650. We will also add id to the Window item and name it window:
Window {    id: window    visible: true    width: 650    height: 650
  1. Add the following code inside the Window item:
property int frame: 0;onAfterRendering: { frame++; }Timer {    id: timer    interval: 1000    running: true    repeat: true    onTriggered: { frame = 0; }}
  1. Right after that, add Repeater and Image under ...

Get Qt5 C++ GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.