I'm developing in qt 5.3 on android device. I can't get the screen resolution. With the old qt 5 version this code worked:
QScreen *screen = QApplication::screens().at(0);
largh=screen->availableGeometry().width();
alt =screen->availableGeometry().height();
However now it doesn't work (returns a screen size 00x00). Is there another way to do it? thanks
Method 1 of 2: Tap the icon in your Apps menu or home screen to open the Settings menu. You can also swipe down from the top of the screen and then tap the gear icon in the resulting drop-down menu. Not all Android phones have the option to change your screen resolution in the Settings menu.
Qt for Android enables you to develop Qt applications for Android devices, and supports a wide range of features and use-cases. To download and install Qt for Android, follow the instructions on the Getting Started with Qt for Android page. To build Qt from source, see Building from Source.
Size holds the pixel resolution
screen->size().width()
screen->size().height();
Whereas, availableSize holds the size excluding window manager reserved areas...
screen->availableSize().width()
screen->availableSize().height();
More info on the QScreen class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With