Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
6.0.0
-
None
-
Fedora 33
Description
If there is a bindable Q_PROPERTY without WRITE attribute, like this:
class Foo : public QObject { Q_OBJECT QML_ELEMENT Q_PROPERTY(int count READ count BINDABLE countBindable) public: int count() const { return mCount; } QBindable<int> countBindable() { return &mCount; } private: Q_OBJECT_BINDABLE_PROPERTY(Foo, int, mCount, nullptr) };
Then setting a change handler on it in QML:
Foo {
onCountChanged: console.info("count changed")
}
Will result in following error:
qrc:/main.qml:50:25: Invalid property assignment: "count" is a read-only property
This looks like a bug, since not having a setter shouldn't be prevent property from being observable.
Attachments
Issue Links
- duplicates
-
QTBUG-89469 Allow creation of bindable but read-only properties
- Reported