Create an application that respect whatever the inch of a device



  • Hello everybody,

    I'm so very proud to be in this forum. Its motivate me to continue to learn Qt. Yesterday, i install my first small app on my tablet, i was very glad. Today, i worked a lot in order to know more. I have 1 questions :
    How can i set my app in order to respect any inch of a device. I install my first app in my tablet(Archos 8o Xenon 8''), the mainform respect he screen. When i install it in my Samsung Galaxy, i can not see some components. Can someone explain me that? Please.

    Thak you


  • Qt Champions 2016

    In order to support different screen resolution and keep UI be consistent , Android recommends a cross device Density-independent pixel , dp , to replace pixel as the display unit for UI component.

    http://developer.android.com/guide/practices/screens_support.html

    The concept of DP is quite similar to DPI but its value is simplified in range of 0.75,1,1.5,2,3 etc.

    Unfortunately QT do not provide the DP unit yet. You need to handle by yourself and use library like this one:

    https://github.com/benlau/quickandroid

    Check the example could see how it works.



  • If it is a widget application:

    then use layouts and forget the graphical dialog designer. Better create the whole content by source code. Use nested layouts to arrange things horizontally, vertically or int able form. Avoid to set any position or size because these values are pixels.
    In some rare cases where position/size parameters cannot be avoided, make them relative to the font size.

    Example: if a text editor field has a size of 300x200 pixels it might look fine on most desktop computers. But many mobile devices have a much higher screen resolution, so the text editor appears too small.

    But if you say, the size of the text editor is width=20*fontSize, height=15xfontsize, then it looks fine on any display.

    But this is not possible in the graphical designer tool.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.