Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Potential Qt5 bug on Android. Screen.Width * Screen.devicePixelRatio off by 1 pixel
Forum Updated to NodeBB v4.3 + New Features

Potential Qt5 bug on Android. Screen.Width * Screen.devicePixelRatio off by 1 pixel

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 825 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NihilishN Offline
    NihilishN Offline
    Nihilish
    wrote on last edited by Nihilish
    #1

    Hi,

    Me and my team have been noticing that on some Android devices with Qt5.15, there is a 1px white line on the short side of the screen (rotates when the device changes orientation). I've been looking like crazy to figure out where it was coming from and it seems like the only thing that makes it disappear is set visible: false on the main Window object (in our main.qml). Hiding any of the child views doesn't fix it.

    So I got curious. I added handlers in the main QML window for onWidthChanged() and I logged Screen.width * Screen.devicePixelRatio on a device that had this issue (Google Pixel 8 Pro). The output was 2991. Then in the MainActivity.java file, I did:

    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    int height = displayMetrics.heightPixels;
    int width = displayMetrics.widthPixels;
    
    Log.d("ANDROID_QT", "MainActivity.java: width: " + width);
    

    and lo and behod, the output is 2992.

    So Qt is shaving off 1 pixel somewhere and that is causing a 1 pixel white line. My questions are:

    • Is this a known Qt5 bug?
    • Did anyone else come across this?
    • Is there a workaround?
    • Would this be fixed if we migrated to Qt6?
    JKSHJ 1 Reply Last reply
    0
    • NihilishN Nihilish

      Hi,

      Me and my team have been noticing that on some Android devices with Qt5.15, there is a 1px white line on the short side of the screen (rotates when the device changes orientation). I've been looking like crazy to figure out where it was coming from and it seems like the only thing that makes it disappear is set visible: false on the main Window object (in our main.qml). Hiding any of the child views doesn't fix it.

      So I got curious. I added handlers in the main QML window for onWidthChanged() and I logged Screen.width * Screen.devicePixelRatio on a device that had this issue (Google Pixel 8 Pro). The output was 2991. Then in the MainActivity.java file, I did:

      DisplayMetrics displayMetrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
      int height = displayMetrics.heightPixels;
      int width = displayMetrics.widthPixels;
      
      Log.d("ANDROID_QT", "MainActivity.java: width: " + width);
      

      and lo and behod, the output is 2992.

      So Qt is shaving off 1 pixel somewhere and that is causing a 1 pixel white line. My questions are:

      • Is this a known Qt5 bug?
      • Did anyone else come across this?
      • Is there a workaround?
      • Would this be fixed if we migrated to Qt6?
      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi @Nihilish, it could be this bug: https://bugreports.qt.io/browse/QTBUG-87334 If that's the case, then the latest version (Qt 6.9.1) should be fixed

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      NihilishN 1 Reply Last reply
      0
      • JKSHJ JKSH

        Hi @Nihilish, it could be this bug: https://bugreports.qt.io/browse/QTBUG-87334 If that's the case, then the latest version (Qt 6.9.1) should be fixed

        NihilishN Offline
        NihilishN Offline
        Nihilish
        wrote last edited by
        #3

        @JKSH Thank you, this is exactly what I'm seeing. As a workaround before we migrate to Qt 6, we tried removing this flag AA_EnableHighDpiScaling and while it does get rid of the white line, it breaks other things

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved