How to check if the application is being loaded into a phone screen or a tablet screen?
-
I am building a unified display UI, where I have to check if the device which is using the app is a phone (small display), or a tablet (bigger display).
If its a phone, it will hide some content (as there is not enough space), while if its a tablet it will show the whole content.
How can I check this?
Lets say, in both versions the app will be load in Portrait Mode.
Thanks guys!
-
Hi,
What platform are you targeting ? iOS ? Android ?
-
Use the QScreen, check the physical dimension (not the pixel resolution) of the screen and determine the break point where you consider a device a tablet or a phone.
Take into account that there is no such real difference between a tablet and a phone.
So, if you suppose that a tablet is something that has more than 7'' display, then calculate the screen dimension from QScreen and if it's above 7'' you display the tablet UI, otherwise the phone UI. -
[quote author="SGaist" date="1417553970"]
What platform are you targeting ? iOS ? Android ?[/quote]
Hi SGaist, I am making a cross-platform application that targets anything with a touch screen in the Operating Room. However I am starting with a phone/tablet prototype, and it targets both platforms.
-
Gianluca, thank you for your suggestion. Sounds great! I will totally try that.
Thank you again!
-
Hi,
you can also see this blog post we recently published about supporting multiple screens with Qt:
http://v-play.net/2014/11/supporting-multiple-screen-sizes-and-screen-densities-with-qt-and-v-play/We added a property "tablet":http://v-play.net/doc/vplay-gamewindowapplicationwindow/#tablet-prop, which sounds like it is doing what you are looking for..
Cheers,
Chris