Nominate our 2022 Qt Champions!

How to improve qml application program's speed

  • Hi everyone:i meet a trouble,it's very emergency,we did a picture viewer,we use QML write user interface,use C++ implement application logic,when we carry out the program,slide the cellphone screen to view picture one by one ,it too slow to bear,so can you give me some advices to solve this problem?thanks very much!

  • I think it's depends on your code and QML itself. If there is nothing wrong with your code, you can wait Qt Quick 2.0, and there will be maybe totally 2.5x speed improve. But in my opinion, the applications work fine on my phone, nothing seems wrong :)

  • I agree with Chuck.Gao. It's depends on your code.

    • Try to use QDeclarativeItem for complex things.
    • Less Gradients.

  • thanks for your reply!how to improve the qml ListView's speed when switch page to view next picture,i have set relative properties in qml ListView about improve speed,but it didn't work,so can you give me some ways ?

  • Hi, have you read this performance tip article:
    I have an application which uses ListView which definitely needed speeding up.

    For me, the best tip in the article was preferring anchoring instead of binding. Actually my app used to use Row and Column components, but anchoring was also much faster than using the layout elements.

    Also keeping delegates as simple as they can be gave a little bit more speed.

    I used to have a gradient with four stops which also gave its own overhead. I created similar gradients in a vector graphics application and saved those as .png's and imported them with Image element instead.

    Combining all these improvements (with a help of cacheBuffer), I managed to get quite velvet panning for my view :)

    edited: corrected a typo

  • I am going to try to find you a blog posting I once saw about speeding up QML apps. The biggest item in the posting was about not using Rectangles over Rectangles. Each Rectangle needs to be drawn. So if you have a Rectangle that will really never be seen, use Item instead. That way the program doesn't need to draw a Rectangle that will never be seen. I hope this makes sense. I will post link if I can find it again.

  • Yeah, removing overlapping items should help. In addition, there is this:

    It's also an issue which considers every QML app, even if they don't use ListView's.

  • Thanks matrixx,

    You certainly know where to get good stuff!

    Cheers, Eddy

Log in to reply