싱글톤을 객체의 속성으로 접근할 수 없음
qmllint에서는 이 경고 범주를 ‘ [access-singleton-via-object] ’로 표기합니다.
객체를 통해 싱글톤에 접근
무슨 일이 발생했나요?
네임스페이스에서 부착된 속성에 접근하는 구문을 사용하여 싱글톤에 접근했습니다.
왜 문제가 될까요?
싱글톤은 이러한 방식으로 접근할 수 없습니다. 이 표현식은 undefined로 평가됩니다.
예시
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
}이 경고를 해결하려면, 싱글톤을 사용하려는 경우 네임스페이스 앞에 있는 ` id ` 또는 `property`를 제거하십시오. 또는, 첨부 속성에 접근하려는 경우 오타가 없는지 확인하십시오.
© 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.