I have the following code:
class Channel(QObject):
nameChanged = pyqtSignal()
def __init__(self, props, *args, **kwargs):
super().__init__(*args, **kwargs)
self._name = props["name"]
@pyqtProperty("QString", notify=nameChanged)
def name(self):
return self._name
@name.setter
def name(self, name):
self._name = name
self.nameChanged.emit()
This works perfectly for my current (prototyping) needs. But let's say that props
will have some more keys that I'm also interested in having as pyqtPrierty
.
Is there a way I can generate the setter and the property methods for all the keys in props
?