Hello community,
So I’m extending the Publisher with some extra UI elements for some extra functionality. Bare with me, I’m not an expert in Qt.
Now, I’ve added a QListWidget which holds soms items. But I’m having some issues with the getter and setter.
So first I populate the list with a function that creates the items. Then I use the following code for the getting and setting. Obviously the setter code is not done yet. So mainly debugging and printing stuff there.
@property
def worker_selection(self):
checked_items = []
for index in range(self.workers_list.count()):
if self.workers_list.item(index).checkState() == QtCore.Qt.Checked:
checked_items.append(self.workers_list.item(index))
return checked_items
@worker_selection.setter
def worker_selection(self, value):
for v in value:
print v
print v.isSelected()
Now when I select an item in the UI, go to another “layer” in the Shotgun view on the left and go back to the list again, I’m getting:
Internal C++ object (PySide2.QtWidgets.QListWidgetItem) already deleted.
So it looks like at the moment I want to do something with the Object in the setter, python deletes it.
Can anybody shine some light on this?
Cheers,
David