In questa pagina

Shadow

Questa categoria di avviso viene indicata da qmllint come " [shadow] ".

Il segnale o il metodo esiste già nel tipo di base

Cosa è successo?

Un membro del componente corrente ha lo stesso nome di un segnale o di un metodo di una classe base.

Si noti che le proprietà che oscurano altre proprietà sono gestite dalla categoria " Sovrascrittura di proprietà ".

Perché è un problema?

Il segnale o il metodo oscurato non può più essere utilizzato. Ciò rende il codice più difficile da leggere e può causare confusione.

Esempio

import QtQuick

Item {
    component Base: Item { signal f(); }
    Base {
        property int f: 42
    }
}

Per risolvere questo avviso, rinominare il segnale f oppure la proprietà int che lo oscura.

import QtQuick

Item {
    component Base: Item { signal f(); }
    Base {
        property int notF: 42
    }
}

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