読み取り専用プロパティ
この警告カテゴリは、qmllint では「[read-only-property] 」と表記されます。
読み取り専用プロパティへの代入はできません
何が起きたのか?
読み取り専用プロパティへの書き込みが行われました。
なぜ問題なのでしょうか?
QML エンジンは、読み取り専用プロパティへの書き込みを検出すると、TypeError をスローします。
例
import QtQuick
Item {
id: root
readonly property int someNumber: 10
Component.onCompleted: {
someNumber = 20 // not ok: TypeError: Cannot assign to read-only property
}
}この警告を解消するには、読み取り専用プロパティへの書き込みを削除するか、別の読み取り専用ではないプロパティに書き込みを行うか、あるいはプロパティ定義の作成者である場合は readonly 修飾子を削除してください。
「読み取り専用プロパティ」も参照してください 。
© 2026 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.