Hello Maxime,

you are right, that's a real bug.
Luckily we managed to solve that issue and it will be included in the next 
release.
https://codereview.qt-project.org/#/c/252324/

Cheers

________________________________________
From: PySide <[email protected]> on behalf of Maxime Lemonnier 
<[email protected]>
Sent: 25 February 2019 22:47
To: [email protected]
Subject: [PySide] @Property syntax broken?

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
_______________________________________________
PySide mailing list
[email protected]
https://lists.qt-project.org/listinfo/pyside

Reply via email to