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

GroupSwitchModifier always present in event.modifiers()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 6.1.2
    • Fix Version/s: None
    • Component/s: QPA: X11/XCB
    • Labels:
      None
    • Platform/s:
      Linux/Wayland, Linux/X11

      Description

      Example code:

      import sys
      from PyQt6 import QtCore, QtWidgets
      
      class MainWindow(QtWidgets.QMainWindow):
          def __init__(self, app):
          super().__init__()
          self.show()
      
      def mousePressEvent(self, event):
          print(event.modifiers())
          return super().mousePressEvent(event)
      
      app = QtWidgets.QApplication(sys.argv)
      win = MainWindow(app)
      app.exec()
      

      With the 6.1.1. installation (PyQt6==6.1.1, PyQt6-Qt6==6.1.1) I get the expected results when clicking, for example:

      KeyboardModifier.NoModifier
      KeyboardModifier.ControlModifier
      KeyboardModifier.AltModifier
      KeyboardModifier.ShiftModifier
      

      After upgrade to the latest versions, I get this instead for the same mouse/key presses (on Linux with Xorg and also Wayland):

      KeyboardModifier.GroupSwitchModifier
      KeyboardModifier.GroupSwitchModifier|ControlModifier
      KeyboardModifier.GroupSwitchModifier|AltModifier
      KeyboardModifier.GroupSwitchModifier|ShiftModifier
      

      The same seems to have been reported here for Qt5 but I wasn't  sure whether I should re-open that ticket: QTBUG-95108. That tickets links the bug to QTBUG-49771.

      Also, upon inspecting this, I noticed that an upgrade to current yields these version numbers: PyQt6==6.1.1, PyQt6-Qt6==6.1.2, which are indeed the latest releases on Pypi for these packages. Pinning PyQt6 to any version always pulls the latest PyQt6-Qt6 and I have to pin it separately. That seems weird to me, but I'm not sure if that's a bug and should be reported as such.

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              liaqi Liang Qi
              Reporter:
              le_becc Rebecca Breu
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes