列挙型は型ではない
この警告カテゴリのスペルは[enums-are-not-types] です。
QMLの列挙型は型ではない
何が起こったのでしょうか?
あなたは型アノテーションの中で列挙型の名前を使いました。
なぜ悪いのですか?
列挙型名は型ではないので、型注釈の中では使えません。コンパイラはこのメソッドをC++にコンパイルすることができません。QML Language Serverはこのメソッドを解析できません。
例
// Main.qml import QtQuick Item { enum HelloWorld { Hello, World } function f(e: Main.HelloWorld): bool { return e == World } }
この警告を修正するには、型アノテーションの enum 名を、その型が最大 32 ビット必要な場合はint のように、そうでない場合はdouble のように、その型に置き換えてください。
import QtQuick Item { enum HelloWorld { Hello, World } function f(e: int): bool { return e === World } }
© 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.