Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1751

No longer possible to override signal emission type?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 6.2.2
    • PySide
    • None
    • macOS
    • 258bb0c2b4 (pyside/pyside-setup/dev) 258bb0c2b4 (pyside/tqtc-pyside-setup/tqtc/dev)

    Description

      I suspect this will not be considered a bug, but rather something that was not officially supported before. But I'm curious to know that for sure before I change a bunch of code.

      In PySide<6.2 (including 6.1.3 and all of pyside2), it used to be possible to "override" the type of the emitted signal value in a subclass of a builtin Qt type. For example

      from PySide6.QtWidgets import QSlider, QApplication
      from PySide6.QtCore import Signal
      
      class MyWidget(QSlider):
          valueChanged = Signal(tuple)
      
          def __init__(self):
              super().__init__()
              self.valueChanged.connect(self._on_change)
      
          def setValue(self, value):
              self.valueChanged.emit(value)
      
          def _on_change(self, new_value):
              print("new_value:", new_value)
      
      app = QApplication([])
      wdg = MyWidget()
      
      # PySide <=6.1.3 prints "new_value: (30, 40)"
      # PySide >=6.2 prints "new_value: 0"
      wdg.setValue((30, 40))
      
      app.exec()
      

      Can you confirm whether this is bug, or whether this is something I should give up on being able to do?
      thanks!

      Attachments

        Issue Links

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

          Activity

            People

              ctismer Christian Tismer
              talley Talley Lambert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes