[PySide] @Property syntax broken?
Maxime Lemonnier
maxime.lemonnier at gmail.com
Mon Feb 25 22:47:57 CET 2019
Hi, using the latest pyside2 from PyPi (version 5.12). I fail to use the
decorator syntax with PySide2:
The following works:
-----------------------------------------------------------
from PySide2.QtCore import Signal, Property, Slot, QObject, QTimer
class Foo(QObject):
def __init__(self, parent=None):
super(Foo, self).__init__(parent)
autoUpdateChanged = Signal()
def autoUpdate_(self):
return self._autoUpdate
def autoUpdate__(self, d):
if self._autoUpdate != d:
self._autoUpdate = d
self.autoUpdateChanged.emit()
autoUpdate = Property(bool, autoUpdate_, autoUpdate__, notify =
autoUpdateChanged)
The following fails with Cannot assign to non-existent property
"autoUpdate" :
------------------------------------------------------------------------------------
from PySide2.QtCore import Signal, Property, Slot, QObject, QTimer
class Foo(QObject):
def __init__(self, parent=None):
super(Foo, self).__init__(parent)
autoUpdateChanged = Signal()
@Property(bool, notify = autoUpdateChanged)
def autoUpdate(self):
return self._autoUpdate
@autoUpdate.setter
def autoUpdate(self, d):
if self._autoUpdate != d:
self._autoUpdate = d
self.autoUpdateChanged.emit()
--------------------------
Am-I missusing the syntax? I googled for more than one hour in search for a
similar issue before posting here.
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20190225/665a35e7/attachment.html>
More information about the PySide
mailing list