En esta página

Propiedad readonly

Esta categoría de advertencia se escribe [read-only-property] por qmllint.

No se puede asignar a una propiedad de sólo lectura

¿Qué ha ocurrido?

Se ha escrito una propiedad de sólo lectura.

¿Por qué es malo?

El motor QML lanzará un Type Error cuando vea la escritura de una propiedad de sólo 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 corregir esta advertencia, elimine la escritura en la propiedad de sólo lectura, escriba en otra propiedad que no sea de sólo lectura, o elimine el modificador readonly si usted es el autor de la definición de la propiedad.

Véase también Propiedades de sólo 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.