En esta página

Al componente le falta una propiedad obligatoria

Esta categoría de advertencia se escribe [required] por qmllint.

Falta una propiedad obligatoria en el componente

¿Qué ha ocurrido?

No se ha establecido la propiedad obligatoria de un componente.

¿Por qué es malo?

Las aplicaciones QML en las que faltan propiedades obligatorias en los componentes se comportarán mal: no se iniciarán en absoluto si se detecta estáticamente que falta una propiedad obligatoria. Los componentes creados dinámicamente a los que les falten propiedades requeridas no se crearán en tiempo de ejecución: en su lugar serán nulos.

Ejemplo:

import QtQuick

Item {
    component RepeatMe: Item {
        required property int index;
        required property int helloWorld;
    }

    RepeatMe {} // not ok: required properties index and helloWorld not set

    Repeater {
        model: 10
        RepeatMe {} // not ok: required property index set by Repeater, but not helloWorld
    }
}

Para corregir esta advertencia, establezca las propiedades necesarias:

import QtQuick

Item {
    component RepeatMe: Item {
        required property int index;
        required property int helloWorld;
    }

    RepeatMe {
        index: 0
        helloWorld: 42
    } // ok: all required properties were set

    Repeater {
        model: 10
        RepeatMe {
            helloWorld: index * 2 + 1
        } // ok: all required properties were set: index by the Repeater and helloWorld by the user
    }
}

Véase también Convenciones de codificación QML: propiedades obligatorias.

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