Unsolved Screen Size to make portable to all devices.
-
Hi,
I am using Android, Arm and desktop devices, i want to run the application in all devices, but the screen width and height i dont want to hardcore. i am using Qt to develop the application.
I used
QDesktopWidget widget;
QRect mainScreenSize = widget.availableGeometry(widget.primaryScreen());int w = widget.screen(1)->width(); int h = widget.screen(1)->height();
but in android device i am not getting the properly , can u guys guide me to make the application portable in all devices.?.
-
@Pradeep-Kumar
you should useqApp->primaryScreen()
instead the one from QDesktopWidget. -
i tried
qApp->primaryScreen()->availableSize().width()
qApp->primaryScreen()->availableSize().height()to get the width and height. is this the way, to get width and height?.
-
@Pradeep-Kumar
does it match your phones/emulators screen dimension? -
I tried with Android device, when it comes to orientation what will be the scenario , how to handle?.
-
@Pradeep-Kumar
in QML there is the Screen.orientation property
In widgets you would just receive a resize event i think.