Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Screen.pixelDensity vs Screen.logicalPixelDensity

$
0
0
Hello, I’m polishin the layout of my app and I would like to set the size of items the same (in millimeters) across different platforms (currently I can test on Windows and android). The setup is simple import QtQuick 2.0 import QtQuick.Window 2.0 Item {     height:15*Screen.logicalPixelDensity //this works on windows     .... } On window this is perfect, the item is 1.5 cm high On android (or at least my android device) the items are smaller, but I can get it to work perfectly by replacing the Screen.logicalPixelDensity with Screen.pixelDensity. But if I use Screen.pixelDensity than items are too small on Windows. So should I try to figure out the platform at runtime and use a javascript function to calculate the height based on that platform? Or is there a better option?

Viewing all articles
Browse latest Browse all 4972

Trending Articles