Restricted type

[restricted-type] A restricted type was accessed.

This warning category is spelled [restricted-type] by qmllint.

You can’t access an unscoped enum from here

What happened?

You accessed the value of an enum defined in C++ by its enum type name.

Why is this bad?

Unscoped enums defined in C++ can’t be accessed by their enum type name. They will be undefined at runtime.

Example

where MyClass is defined as

class MyClass: public QObject
{
    Q_OBJECT
    QML_ELEMENT

public:
    enum Hello { World };
    Q_ENUM(Hello);
    ...

};

To fix this warning, remove the unnecessary enum type name from its QML usage:

If you are the author of the enum, you can also modify the enum definition to use an enum class instead of changing the QML code:

class MyClass: public QObject
{
    Q_OBJECT
    QML_ELEMENT

public:
    enum class Hello { World };
    Q_ENUM(Hello);
    ...
};

Note

You can find more information about enum type registration here .