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

Patrick Pelletier code at funwithsoftware.org
Tue Nov 25 03:44:40 CET 2014


I'm new to Qt, and perhaps I'm making a rookie mistake, but I seem to be 
running into what looks like the same bug, just compiling and running 
the "Maroon in Trouble" example app that comes with Qt Creator.

I'm building with Qt Creator 3.2.2, based on Qt 5.3.2, on Mac OS X 
10.9.5, and running on a Samsung Galaxy S 4, which is running Android 4.4.2.

The game appears at a tiny, pretty much unplayable size in the 
upper-left corner of the phone's screen, with most of the screen blank 
white.  There are some other artifacts, too, such as that the fonts seem 
about the right size for the full screen (and thus much too big for the 
tiny game), the waves extend all the way to the right side of the 
phone's screen, even though nothing else does, and the game's splash 
screen appears below the game itself while it is being played.

It appears from the git history of the qtbase repository that commit 
439a6fec84a62b9d166b84dc7574ddc250a38bfb is included in Qt 5.3.2, so I'm 
unclear why I'm seeing something that sounds like the issue that was 
discussed in this thread.  Is there still an additional bug in Qt 
itself?  Or is there a bug in the "Maroon in Trouble" example app?  Is 
there some other possibility I haven't thought of?

Thanks for any advice,

--Patrick


On 3/4/14, 12:44 AM, Yang Fan wrote:
> Thank Liang Qi, he told me that this bug is already fixed, you may get 
> the patch from the git repo and the commit id is 
> 439a6fec84a62b9d166b84dc7574ddc250a38bfb.
>
>
> On Tue, Mar 4, 2014 at 2:34 PM, Yang Fan <missdeer at gmail.com 
> <mailto:missdeer at gmail.com>> wrote:
>
>     Thanks for your reply. I think this information should be shared
>     with Qt developers, and I noticed the bug you mentioned was closed
>     with no comment, I feel confused.
>
>
>     On Tue, Mar 4, 2014 at 10:46 AM, Daiwei Li <daiweili at gmail.com
>     <mailto:daiweili at gmail.com>> wrote:
>
>         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
>         <mailto: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 <mailto:Interest at qt-project.org>
>             http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
>
>     -- 
>     Regards,
>     Fan Yang
>
>
>
>
> -- 
> Regards,
> Fan Yang
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141124/aef657ad/attachment.html>


More information about the Interest mailing list