이 페이지에서

루트 요소 외부에서 선언된 열거형

qmllint에서는 이 경고 범주를 ‘ [non-root-enum] ’으로 표기합니다.

루트 요소 외부에서 선언된 열거형

무슨 일이 발생했나요?

컴포넌트의 루트 요소 외부에서 열거형이 선언되었습니다.

왜 문제가 될까요?

접근할 수 없게 됩니다. 열거형은 <컴포넌트 이름>.<선택적 열거형 이름>.<열거형 항목>의 형식으로 접근합니다. 열거형이 컴포넌트의 루트에 있지 않으면 이 조회 작업이 작동하지 않습니다.

예시

// Main.qml
import QtQuick

Item {
    Item {
        id: item
        enum Color { Red, Green, Blue }
    }
}

이 경고를 해결하려면 열거형을 컴포넌트의 루트로 이동하세요:

// Main.qml
import QtQuick

Item {
    enum Color { Red, Green, Blue } // Accessible in Main.qml but also from other files
    Item {
        id: item
    }
}

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