Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
android screen width always 360?
i am new to qml on android. i have created a sample app (using qt creator's "Qt Quick Application - Empty") , put the code below in main.cpp, and then run it on android devices,
QScreen* primaryscreen = QGuiApplication::primaryScreen(); QRect rect = primaryscreen->geometry(); qreal width = qMin(rect.width(), rect.height()); qreal height = qMax(rect.width(), rect.height()); qDebug() << "w: " << (width) << ", h: " << (height);
oneplus one (android 7.1.2), w: 360, h: 640
redmi 5 (android 7.1.2), w: 360, h: 660
Huawei P10 plus (android 7.1.2), w: 360, h: 660
it seems width is always 360 and height is around 600 something, although the native resolution of all 3 devices are very different. i googling around and can't find doc explaining this 360 figure.
is it a expected behavior?
thx in advance!
PS: qt 5.11.2 open source, running on ubuntu 16.04 LTS
thanks for pointing out availableGeometry()
but the result is still the same. it seems QGuiApplication "masks" the underlying, real screen resolution, and QGuiApplication::primaryScreen() is always 360x600 something. at least it is what looks liked on android device.
(i have tried a windows 10 tablet, with 3840×2160 display. the availableGeometry() returns 1920x1080. QGuiApplication does have some magic in itself)
oh, my mistake.
i haven't paid attention to the very 1st line of code in the main.cpp, which is:
after changing it to AA_DisableHighDpiScaling, the geometry(), availableGeometry(), etc work as expected.