Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to improve my qml app performance? ( QQuickPaintedItem )

How to improve my qml app performance? ( QQuickPaintedItem )

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 233 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TomNow99
    wrote on last edited by
    #1

    Hi,
    I have main qml page, where I have 10 buttons. When user click one of them, qml loads different pages ( I use Loader and loader.source ). One of this page is very heavy ( in this page I have QQuickPaintedItem, which do heavy calculations ). Everytime, when user click on Button1, user has to wait. Is it possible to create that page only once and keep it on variable or in memory?

    main.qml:

    Loader {
       id: loader
    }
    
    Button1 {
       onClicked {
          loader.source = page1.qml;
       }
    }
    
    sierdzioS 1 Reply Last reply
    0
    • T TomNow99

      Hi,
      I have main qml page, where I have 10 buttons. When user click one of them, qml loads different pages ( I use Loader and loader.source ). One of this page is very heavy ( in this page I have QQuickPaintedItem, which do heavy calculations ). Everytime, when user click on Button1, user has to wait. Is it possible to create that page only once and keep it on variable or in memory?

      main.qml:

      Loader {
         id: loader
      }
      
      Button1 {
         onClicked {
            loader.source = page1.qml;
         }
      }
      
      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @TomNow99 There are a few solutions which you can use, or combine them for biggest effect:

      • keep your heavy page in a separate loader and only hide it (visible = false) when user navigates away from it. This is probably the easiest solution to do
      • in your painted item, cache the results: render your item into a QImage (or something else) and keep that image stored somewhere. Then when user navigates back to heavy page, show the image instead of rendering the whole item from scratch

      (Z(:^

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved