[PySide] @Property syntax broken?

Maxime Lemonnier maxime.lemonnier at gmail.com
Wed Feb 27 16:20:11 CET 2019


Nice job!

Thank you



On Wed, Feb 27, 2019 at 8:51 AM Cristián Maureira-Fredes <
Cristian.Maureira-Fredes at qt.io> wrote:

> 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 <pyside-bounces at qt-project.org> on behalf of Maxime
> Lemonnier <maxime.lemonnier at gmail.com>
> Sent: 25 February 2019 22:47
> To: pyside at qt-project.org
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20190227/1173020e/attachment.html>


More information about the PySide mailing list