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

QCursor::pos() returns wrong results on a multi-monitor setup when HiDPI is enabled

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Run the following script with environment QT_SCALE_FACTOR=2, then move the cursor around. The output value jumps whenever the cursor crosses the monitor boundary.

      #!/usr/bin/python3
      import sys
      from PyQt5.QtWidgets import QApplication
      from PyQt5.QtCore import QObject
      from PyQt5.QtGui import QCursor
      from PyQt5.QtCore import QTimer
      
      a = QApplication(sys.argv)
      t = QTimer()
      t.setSingleShot(False)
      t.setInterval(50)
      t.timeout.connect(lambda: print(QCursor.pos().x(), QCursor.pos().y()))
      t.start()
      a.exec()
      

      My test setup consists of a 2560x1440 display and a 1920x1080 display to its right. The X coordinate is in range of [0,1280] when the cursor is on the first display and [2560,3520] when it's on the second display, rendering the result from QCursor::pos() mostly unusable.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            chrisxiong Chris Xiong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes