I have this following code snippet to evaluate rowsMoved. I have used the QT editor and don't want to have to subclass (as other examples seem to want to show) and do are replaceWidget for every list widget in the program
So i stumbled upon rowsMoved though @vince in PySide: Drag and drop files into QListWidget
self.win.list_SocketGroups.model().rowsMoved.connect(self.my_method)
@Slot()
def my_method(self, parent, start, end, destination, row):
print("my_method, rows moved parent", type(parent), parent)
print("my_method, rows moved start", type(start), start)
print("my_method, rows moved end", type(end), end)
print("my_method, rows moved destination", type(destination), destination)
print("my_method, rows moved row", type(row), row)
print()
the output is :
<PySide6.QtWidgets.QLineEdit(0x26890824100, name="lineedit_SkillLabel") at 0x00000268913140C0>
my_method, rows moved parent <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689998AEC0>
my_method, rows moved start <class 'int'> 0
my_method, rows moved end <class 'int'> 0
my_method, rows moved destination <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689600D8C0>
my_method, rows moved row <class 'int'> 2
<PySide6.QtWidgets.QLineEdit(0x26890824100, name="lineedit_SkillLabel") at 0x00000268913140C0>
my_method, rows moved parent <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689998AEC0>
my_method, rows moved start <class 'int'> 0
my_method, rows moved end <class 'int'> 0
my_method, rows moved destination <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689600D8C0>
my_method, rows moved row <class 'int'> 2
<PySide6.QtWidgets.QLineEdit(0x26890824100, name="lineedit_SkillLabel") at 0x00000268913140C0>
my_method, rows moved parent <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689998AEC0>
my_method, rows moved start <class 'int'> 0
my_method, rows moved end <class 'int'> 0
my_method, rows moved destination <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689600D8C0>
my_method, rows moved row <class 'int'> 2
<PySide6.QtWidgets.QLineEdit(0x26890824100, name="lineedit_SkillLabel") at 0x00000268913140C0>
my_method, rows moved parent <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689998AEC0>
my_method, rows moved start <class 'int'> 0
my_method, rows moved end <class 'int'> 0
my_method, rows moved destination <class 'PySide6.QtCore.QModelIndex'> <PySide6.QtCore.QModelIndex(-1,-1,0x0,QObject(0x0)) at 0x000002689600D8C0>
my_method, rows moved row <class 'int'> 2
As can be seen, it is called four times, with the same information.
The Question: Was there something I was to do to acknowledge the call, like an event has event.accept and ignore, to stop the call coming through four times ?
Thanks