What are the benefits of using QQuickItem and QQuickPaintedItem instead of QML elements ?
-
What are the benefits of using QQuickItem and QQuickPaintedItem instead of QML elements ?
-
A very general question. They allow you to use c++ and remaining Qt classes to boost standard capabilities of QML. They allow to create new QML components. Hard to say anything without more specific questions, though.
-
I'll try to be more specific:
When I mean benefits I mean performance.
Lets say If I create create 2 elements that looks the same - one with QML elements and the other with QQuickItem or QQuickPaintedItem.
Which one of them will be loaded first ? -
Try it. It all depends.
If you expand QML with QQuickItem, you are obviously adding to the code that is already there, so you can impact the performance negatively. However, QML uses meta objects to work anyway, so in most cases it's improbable that there would be any real difference.
-
It depends on what you're painting.
If you can implement a complex scene in a single QQuickPaintedItem or whatever, using raster painting, you still might outperform a similarly complex scene composed of multiple QQuickItems - at least instantiation will be faster, so your first time startup application performance will be quicker, even if rendering is slower.
It depends on what sort of layouts you use, what sort of positioning you use, what sort of effects you use, what sort of animation you do.
In general case applications, I'd be surprised if you could beat the performance of just using QtQuick items, but in some specific cases it's certainly possible.
Cheers,
Chris. -
Thanks Chris