我目前正在研究Qt上的移动开发。我不太明白Screen.width和Screen.height返回的值。我正在使用两个设备: Xperia Z5 Compact720x1200分辨率和Galaxy 4 (1200x800)。但是在肖像定位方面,我有(对于xperia)
Screen.width = 320
Screen.height = 592而对于银河系来说:
Screen.width = 601
Screen.height = 962那么,如果属性width和height of Screen不是以像素为单位的分辨率,它们是什么?
发布于 2017-08-24 15:30:33
问题是像素比。这里有一个更好的解释:https://developer.mozilla.org/it/docs/Web/API/Window/devicePixelRatio。
要找到真正的解决方案,请尝试如下:
alert('window.devicePixelRatio*screen.width: ' + window.devicePixelRatio*screen.width);或者在智能手机上打开这个:window.devicePixelRatio
https://stackoverflow.com/questions/45865127
复制相似问题