Readonly property
read-only-property
This warning category is spelled c{[read-only-property]} by qmllint.
Cannot assign to read-only property
What happened?
A read-only property was written.
Why is this bad?
The QML engine will throw a Type Error when it sees the write to a read-only property.
Example
import QtQuick Item { id: root readonly property int someNumber: 10 Component.onCompleted: { someNumber = 20 // not ok: TypeError: Cannot assign to read-only property } }
To fix this warning, remove the write to the read-only property, write to another non-read-only property, or remove the readonly modifier if you are the author of the property definition.
See also Read-Only Properties.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.