标题:qml中怎么样去获取iPhone的屏幕尺寸啊
作者:seanyxie
日期:2014-07-24 22:42
内容:
最近再写一个小程序,qml的主rectangle大小设置的是 360*480
移植到iPhone上后,效果是这样的
很明显右边的尺寸不对
请问下改怎么办
或者再qml中怎么来动态获取屏幕的尺寸
#1 [seanyxie 07-24 23:24]
好吧 我写错了,应该是320
不过还是想知道怎么获取屏幕分辨率
#2 [toby520 07-25 09:30]
楼主可以查阅下Qt帮助文档 其中有段
platform.osThis read-only property contains the name of the operating system.
Possible values are:
"android" - Android
"blackberry" - BlackBerry OS
"ios" - iOS
"linux" - Linux
"osx" - OS X
"unix" - Other Unix-based OS
"windows" - Windows
"wince" - Windows CE
这个是判断平台的 如果是ios平台就可以得到该平台的屏幕尺寸 Screen这个控件
desktopAvailableHeight : int
desktopAvailableWidth : int
height : int
name : string
orientation : Qt::ScreenOrientation
pixelDensity : real
primaryOrientation : Qt::ScreenOrientation
width : int
希望对你有帮助
#3 [彩阳 07-25 13:49]
我专门写了一篇文章,可能对你有帮助。
#4 [seanyxie 07-29 17:59]
好 谢谢楼上两位~~~