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

이 경고 범주의 철자는 [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
    }
}

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