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

Cannot emit QAbstractItemModel.layoutAboutToChange with parameters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.3.0
    • PySide
    • None
    • Python 3.10.5
      PySide6 6.3.0
      shiboken6 6.3.0

    Description

      Trying to emit the QAbstractItemModel.layoutAboutToChange signal with the parents list and/or the LayoutChangeHint raises a TypeError

      from PySide6.QtCore import Qt, QAbstractListModel
      
      
      class SkeletonModel(QAbstractListModel):
          def rowCount(self, parent):
              return 0 if parent.isValid() else 3
      
          def data(self, index, role=Qt.DisplayRole):
              return None
      
          def sort(self, column, order=Qt.AscendingOrder):
              self.layoutAboutToBeChanged.emit([], QAbstractListModel.VerticalSortHint)
              self.layoutChanged.emit([], QAbstractListModel.VerticalSortHint)
      
      
      m = SkeletonModel()
      m.sort(0)
      
      Traceback (most recent call last):
        File "script.py", line 17, in <module>
          m.sort(0)
        File "script.py", line 13, in sort
          self.layoutChanged.emit([], QAbstractListModel.VerticalSortHint)
      TypeError: layoutChanged() only accepts 0 argument(s), 2 given!

      The same error (lack or an overload) seems to also affect layoutChanged signal. Same behaviour in PySide2 and PySide6.

       

      Attachments

        1. pyside1978_str.py
          0.7 kB
        2. pyside1978.py
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            aleserjavec Ales Erjavec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: