En esta página

Propiedad de solo lectura

qmllint escribe esta categoría de advertencia como « [read-only-property] ».

No se puede asignar un valor a una propiedad de solo lectura

¿Qué ha pasado?

Se ha escrito en una propiedad de solo lectura.

¿Por qué es un error?

El motor de QML generará un error de tipo (Type Error) al detectar que se ha intentado escribir en una propiedad de solo lectura.

Ejemplo

import QtQuick

Item {
    id: root
    readonly property int someNumber: 10

    Component.onCompleted: {
        someNumber = 20  // not ok: TypeError: Cannot assign to read-only property
    }
}

Para solucionar esta advertencia, elimina la escritura en la propiedad de solo lectura, escribe en otra propiedad que no sea de solo lectura o elimina el modificador «readonly» si eres el autor de la definición de la propiedad.

Véase también Propiedades de solo lectura.

© 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.