이 페이지에서

인라인 컴포넌트 열거형

qmllint에서는 이 경고 범주를 ‘ [inline-component-enums] ’로 표기합니다.

인라인 컴포넌트 내부에서 선언된 열거형은 무시됩니다

무슨 일이 발생했나요?

인라인 컴포넌트 내에서 열거형을 정의했습니다.

왜 문제가 될까요?

QML 언어는 QML 파일의 루트 항목 내에서만 열거형 정의를 허용합니다. 인라인 컴포넌트 내부에서 선언된 열거형은 해당 인라인 컴포넌트 내부에서도 사용할 수 없습니다. 루트가 아닌 QML 객체 내부에서 선언된 열거형도 마찬가지입니다.

예시

import QtQuick

Item {
    component MyInlineComponent: Item {
        enum MyEnum { Hello, World }
    }
}

이 경고를 해결하려면 열거형 선언을 QML 파일의 루트 요소로 이동하십시오:

import QtQuick

Item {
    enum MyEnum { Hello, World }
    component MyInlineComponent: 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.