Search code examples
qtqmlscale

QML scaling extremely slow


I'm currently working on a project where I need to scale the whole UI based on a global scale factor. I have about 2000 Items (and yes, I need that much). For now, those are just simple Rectangle, but the will get more complex later. I simulated the final behavior by adding5 rectangles inside each of the "main rectangles".

The problem is, if I change the scale factor, it takes about 3 seconds until the change is done. In this 3 seconds, the application freezes.

It tried different ways of using the scale:

Direct for all scalable properties:

Rectangle {
    width: 50 * global.scale
    height: 50 * global.scale
}

Using the scale property:

Rectangle {
    width: 50
    height: 50
    scale: global.scale
}

However, both of them are equally slow. So, is there a way to zoom the whole ui with having to resize every element? Or anything else, that makes it faster?


Solution

  • The answere was quite simple: Using the debug build can be very slow, but as soon as I started a release build, it worked just fine.