<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 8/3/2018 2:50 AM, Peter Bennett
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:74ed7b2f-35b0-cada-7502-78d8da175937@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <p><br>
      </p>
      <br>
      <div class="moz-cite-prefix">On 08/01/2018 07:47 PM, Mark Spieth
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:729b79bd-7d34-6667-bcfb-80f3a1f4c28c@digivation.com.au">Another
        thing to try<br>
        <br>
        in qt src<br>
        qtbase/src/android/jar/src/org/qtproject/qt5/android<br>
        change all getMetrics calls to getRealMetrics in the java files.<br>
        <br>
        It may be possible to copy these to android-package-source tree
        but not sure as they are in the jar directory not the java
        directory. Should work though and then we can modify them as
        required without patching qt. It would mean a diff/merge on
        updating qt though just in case these change.<br>
        <br>
        The optimal change is to check for PAI or try except get
        realmetrics and then use getmetrics as a fallback. However since
        the APIs we are targeting, this is probably not necessary as
        getRealMetrics should be available always.<br>
        <br>
        Mark<br>
        <br>
      </blockquote>
      Hi Mark<br>
      <br>
      Thanks for the suggestions. I still have no success.<br>
      <br>
      getRealMetrics returns the exact same faulty result as getMetrics.<br>
      <br>
      I found I can get the actual values from
      android.view.Display.Mode.getPhysicalWidth and getPhysicalHeight.
      Those return the real pixel size.<br>
      <br>
      I changed the call to QtNative.setApplicationDisplayMetrics to use
      those real pixel sizes instead of the ones from getMetrics.<br>
      <br>
      Everything looks fine in the log messages:<br>
      <br>
      androidjnimain.cpp setDisplayMetrics wP=3840 hP=2160 dWP=3840
      dHP=2160 xdpi=213.000000 ydpi=213.000000 sD=2.000000 d=2.000000<br>
      qandroidplatformintegration.cpp setDefaultDisplayMetrics gw=3840
      gh=2160 sw=458 sh=258 scrW=3840 scrH=2160<br>
      androidjnimain.cpp createSurface x=0 y=0 w=100 h=30<br>
      androidjnimain.cpp setSurfaceGeometry x=0 y=0 w=3840 h=2160<br>
      <br>
      HOWEVER, on the screen is now a hugely enlarged version of the top
      left hand corner of the MythTV GUI. MythTV is drawing it to the
      correct 4K size but QT and android have taken the picture and
      scaled it to twice the size.<br>
      <br>
      The Android documentation of
      android.view.Display.Mode.getPhysicalWidth states<br>
      <br>
      <i>Note that due to application UI scaling, the number of pixels
        made available to applications when the mode is active (as
        reported by Display.getHeight() may differ from the mode's
        actual resolution (as reported by this function).</i><i><br>
      </i><i><br>
      </i><i>For example, applications running on a 4K display may have
        their UI laid out and rendered in 1080p and then scaled up.
        Applications can take advantage of the extra resolution by
        rendering content through a SurfaceView using full size buffers.</i><i><br>
      </i><br>
      It seems to me that this is what we are doing, without success.<br>
    </blockquote>
    Some more ideas...<br>
    <br>
    1. In AndroidManifest.xml set android.app.auto_screen_scale_factor
    to true<br>
    <br>
    2. <a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/42898179/android-ui-scale">https://stackoverflow.com/questions/42898179/android-ui-scale</a><br>
    set scale factor using the getPhysicalWidth or perhaps
    getDisplayMetrics(). May work. <br>
    OnCreate is in
    src/org/qtproject/qt5/android/bindings/QtActivity.java<br>
    <br>
    We dont have a layout file so cant adapt this. my search terms are
    "android application ui scaling"<br>
    <br>
    HTH but probably not<br>
    Mark<br>
    <br>
    <br>
    <br>
    <br>
  </body>
</html>