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.
| For Gerrit Dashboard: PYSIDE-1978 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 419735,2 | libpyside: Improve error message about using the wrong signal overload | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
| 419742,3 | libpyside: Improve error message about using the wrong signal overload | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
| 419743,2 | libpyside: Add debug operators for some signal structures | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
| 419798,4 | Fix signal QAbstractItemModel::layoutAboutToBeChanged(QList<QPersistentModelIndex>) | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
| 420463,3 | Fix signal QAbstractItemModel::layoutAboutToBeChanged(QList<QPersistentModelIndex>) | 6.3 | pyside/pyside-setup | Status: MERGED | +2 | 0 |