[Interest] qt-android: How to make QML application scaled on high DPI screen automatically

Daiwei Li daiweili at gmail.com
Tue Mar 4 03:46:59 CET 2014


Hi Yang and all,

I'm curious about how to scale for high DPI on Android as well, so I did
some reading of the Qt source today.

On iOS and OSX, scaling is handled by implementing devicePixelRatio() in
the respective QPlatformWindow implementations. On Android, the equivalent
concept seems to be "density":
http://developer.android.com/reference/android/util/DisplayMetrics.html#density.
Right now, the Android code uses the "scaledDensity" for certain things:
https://bugreports.qt-project.org/browse/QTBUG-29674, but not for
implementing the devicePixelRatio.

Can someone with domain knowledge weigh in on how scaling is supposed to
work? Otherwise, I'll experiment with hooking up devicePixelRatio to
DisplayMetrics.density and report back.

Thanks,
Daiwei
On Mar 1, 2014 7:41 PM, "Yang Fan" <missdeer at gmail.com> wrote:

> Hi list,
>
> I'm writing a cross platform application with QML, all things go well
> except running on high DPI Android device, it seems that it doesn't auto
> scaled correctly, the elements look small on the high DPI screen while it
> looks good on iOS device. I have got the physical dots per inch, it is
> about 210, I know I could get the factor from this value, and let all
> elements size multiply the factor manually, but I wonder if there is an
> easy way that let Qt handle this issue just like iOS port does.
> Any suggestion is appreciated.
>
> Regards,
> Fan Yang
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140303/f32894c5/attachment.html>


More information about the Interest mailing list