marmistrz
marmistrz

Reputation: 6414

DPI-independent constant size in QML

I have a visual component in my app written in QML, Qt5. I want it to always have the width of 5 cm on the screen, no matter what device is used.

If I set width: somevalue, then the DPI might differ among the devices which will result in different physical size on different devices.

Is there any way to achieve my goal?

Upvotes: 3

Views: 792

Answers (1)

marmistrz
marmistrz

Reputation: 6414

Well, I've just might've found a solution: Screen.pixelDensity. But feel free to suggest anything better.

Upvotes: 3

Related Questions