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

optional signal parameters added in Qt5 are not supported

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Fixed
    • Affects Version/s: dev
    • Fix Version/s: dev
    • Component/s: PySide
    • Labels:
      None
    • Commits:
      0fd34c2d96dff7260ca281938ba53f59696bc553

      Description

      Run the following code and you will get the error

      # Error: line 1: TypeError: file <maya console> line 29: dataChanged(QModelIndex,QModelIndex,QVector<int>) only accepts 3 arguments, 3 given! # 
      
      from PySide2 import QtGui
      
      def on_data_changed(top_left, bottom_right, roles=None):
         print "Data changed, TL: %s, BR: %s, Roles: %s" % (top_left, bottom_right, roles)
      
      class SignalWrapper(object):
         def __init__(self, signal):
             self._signal = signal
         def emit(self, tl, br):
             self._signal.emit(tl, br, [])
         def __getattr__(self, name):
             return getattr(self._signal, name)
      
      class MyModel(QtGui.QStandardItemModel):
         def __init__(self, parent=None):
             QtGui.QStandardItemModel.__init__(self, parent)
             # adding this line will patch the dataChanged signal to behave like the PySide1 version
             #self.dataChanged = SignalWrapper(self.dataChanged)
      
         def emit_data_changed(self):
             top_left = self.index(0, 0)
             bottom_right = self.index(0, 0)
             roles = [1,2]
      
             # this works:
             # self.dataChanged.emit(top_left, bottom_right, roles)
      
             # this doesn’t unless you uncomment the ‘fix’ in __init__
             self.dataChanged.emit(top_left, bottom_right) # PySide1 version
      
      model = MyModel()
      model.dataChanged.connect(on_data_changed)
      model.emit_data_changed()
      

        Attachments

        1. pyside462_menu.py
          1 kB
        2. pyside462.py
          1 kB

          Issue Links

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

            Activity

              People

              • Assignee:
                alexandru.croitor Alexandru Croitor
                Reporter:
                warnold Wayne Arnold
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes