Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82723

Wrong cursor position when using tablet and hidpi screen on Linux

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.14.1
    • Fix Version/s: None
    • Component/s: GUI: High-DPI
    • Labels:
      None
    • Environment:
      Kubuntu 19.10, Qt 5.14.1 installed using MaintenanceTool.
      Wacom Bamboo using the pen in absolute mode.
    • Platform/s:
      Linux/X11

      Description

      When using my Wacom Bamboo tablet in absolute mode and a desktop in HiDPI mode, Qt calculates wrong cursor positions: they're offset by what looks to be ($scale - 1) / $scale * $windowPosition. So in other words, the calculated position is correct if the window is positioned in the upper left corner without a window frame, and then scales linearly if the window is moved away from that corner.

      the $scale is set using QT_SCREEN_SCALE_FACTORS.

      I've attached a screenshot of a test program I wrote to investigate this (shows bug: PosBug_Pen_Scaled.png; shows expected behaviour: PostBug_Mouse_Scaled.png), as well as that program itself.

      Looking at the numbers, it's clear that QMouseEvent::globalPos() as well as QCursor :: pos() are correct, but everything window-relative is not.

      When using the mouse, or a scale factor of 1, everything works fine. Also, I don't see this bug when compiling with Kubuntu's system-Qt (5.12.4), nor do I remember encountering this with older Qt versions.

        Attachments

        1. drawtest.zip
          5 kB
        2. PosBug_Mouse_Scaled.png
          PosBug_Mouse_Scaled.png
          64 kB
        3. PosBug_Pen_Scaled.png
          PosBug_Pen_Scaled.png
          67 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            sorvig Morten Sørvig
            Reporter:
            maxlor Benjamin Lutz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes