Details
Description
PySide2 generates TypeError when use Property decorator with constant=True
TypeError: A constant property cannot have a WRITE method or a NOTIFY signal.
To reproduce - prepare the simple class:
class A(QObject):
def __init__(self):
QObject.__init__(self)
self.val = str("")
when executing python script PySide2 generates TypeError for this code:
@Property(str, constant=True)
def variable(self):
return self.val
However, when we transform the previous code into this:
def getVal(self):
return self.val
variable = Property(str, getVal, constant=True)
It works.
In PySide 5.15.0 it all works fine but for version 5.15.1 and 5.15.2 the decorator example generates TypeError.
Attachments
Issue Links
- is duplicated by
-
PYSIDE-1642 Declaring a Property as constant raises an exception
- Closed