Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.8.3
-
None
Description
When using qmllint on a QML application that calls a C++ Q_INVOKABLE method with a parameter of an enum type declared within the class, qmllint issues a warning about argument count/type if the enum type in the method signature is not fully qualified with the class name.
If the C++ method is declared as:
class MyItem : public QObject { Q_OBJECT public: enum Operation { Normal, Immediate }; Q_ENUM(Operation) Q_INVOKABLE void doSomething(Operation op = Normal) { /* ... */ } };
Then a QML call like:
MyItem { id: item } Component.onCompleted: item.doSomething(item.Immediate)
generates a warning:
Function expects 0 arguments, but 1 were provided type Operation for argument 0 cannot be resolved [compiler]
When the method is declared as:
Q_INVOKABLE void doSomething(MyItem::Operation op = MyItem::Normal);
The warning goes away.
This issue is not limited to user-defined types: it also affects several built-in QtQuick QML types such as StackView and TableView. For example, methods like StackView.popToItem(item, StackView.Immediate) and TableView.positionViewAtRow(row, TableView.Visible, 0.0) will trigger similar warnings from qmllint.