How it works...

The QML engine that powers Qt Quick applications are very optimized and powerful when it comes to rendering animated graphics on screen. However, there are still some tips that we can follow to make it even faster.

Try and make use of the built-in features provided by Qt 5 instead of implementing your own, such as Repeater, NumberAnimation, and SequentialAnimation. This is because Qt 5 developers have put great effort into optimizing these features so that you don't have to.

The sourceSize properties tell Qt to resize the image before loading it into memory so that large images do not use more memory than necessary.

The smooth property, when enabled, tells Qt to filter the image to make look it smoother when scaled or transformed from its natural size. It will not make any difference if the image is rendered at the same as its sourceSize. This property will impact the performance of your application on some older hardware.

The antialiasing property tells Qt to remove the aliasing artifacts around the edge of the image and make it look smoother. This property will also impact the performance of your program.

The asynchronous property tells Qt to load the image under a low priority thread, which means that your program will not stall when loading a huge image file.

We used the frame rate for indicating the performance of our program. Since onAfterRendering always gets called on every frame, we can then accumulate the frame variable on every render. Then, we used Timer to reset the frame value every second. Finally, we displayed the value on screen using a Text item.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset