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

GroupSwitchModifier always present in event.modifiers()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.2.1, 6.3
    • 6.1.2
    • QPA: X11/XCB
    • None
    • Linux/Wayland, Linux/X11
    • bb4b40b7e1b7cc0af2f0c74a991edf39d64cac06 b587e4c0345ae5efe6889f27e112619cd083294b (qt/tqtc-qtbase/6.2.1)

    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

          For Gerrit Dashboard: QTBUG-95289
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews