Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
missing-enum-entry.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\ingroup qmllint-warnings-and-errors
6
7
\title Missing enum entry
8
\brief [missing-enum-entry] Enum value is missing from its declaration.
9
10
\qmllintwarningcategory missing-enum-entry
11
12
\section1 Is not an entry of enum
13
14
\section2 What happened?
15
You used an enum value that does not exist.
16
17
\section2 Why is this bad?
18
The enum value will be undefined at runtime.
19
20
\section2 Example
21
\qml
22
// Main.qml
23
import QtQuick
24
25
Item {
26
enum Hello { World }
27
28
Component.onCompleted: function() {
29
console.log(Main.Hello.Wordl, Main.Hello.Moon) // both Wordl and Moon are incorrect
30
}
31
}
32
33
\endqml
34
To fix this warning, correct a potential typo or add the missing enum value
35
to the definition:
36
\qml
37
// Main.qml
38
import QtQuick
39
40
Item {
41
enum Hello { World, Moon }
42
43
Component.onCompleted: function() {
44
console.log(Main.Hello.World, Main.Hello.Moon) // both correct now
45
}
46
}
47
\endqml
48
*/
qtdeclarative
src
qml
doc
src
qmllint
missing-enum-entry.qdoc
Generated on
for Qt by
1.16.1