En esta página

No se puede acceder a un singleton como propiedad de un objeto

qmllint denomina esta categoría de advertencia « [access-singleton-via-object] ».

Acceder a un singleton a través de un objeto

¿Qué ha pasado?

Has accedido a un singleton utilizando la sintaxis para acceder a propiedades asociadas desde un espacio de nombres.

¿Por qué es incorrecto?

No se puede acceder a los singletons de esta manera. La expresión se evaluará como indefinida.

Ejemplo

import QtQml
import QtQuick as QQ

QtObject {
    id: root
    // Cannot access singleton as a property of an object. Did you want to access an attached object?
    property var singletonAccess: root.QQ.Application.platform
}

Para solucionar esta advertencia, elimina « id » o «property» delante del espacio de nombres si tu intención era utilizar el singleton. Como alternativa, comprueba si hay errores tipográficos si lo que querías era acceder a una propiedad asociada.

import QtQml
import QtQuick as QQ

QtObject {
    id: root
    property var singletonAccess: QQ.Application.platform
    property bool attachedPropertyAccess: root.QQ.ListView.isCurrentItem
}

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