Hi
We are in the process of integrating qmllint after migrating a project
to Qt6, and have hit a few issues.
-- QtLocation --
The linter is unable to resolve types in QtLocation. Adding the
following dependencies to qml/QtLocation/qmldir resolved the problem:
depends QtQuick
depends QtPositioning
From what I can see those dependencies should be there, but I am on the
learning curve. If they should be, should a bug report be created?
-- Enums in gadgets --
The linter is unable to resolve enums defined in gadgets (Type not found
in namespace [unresolved-type]). The class definition looks like this:
struct MyType
{
Q_GADGET
QML_ELEMENT
public:
enum class MyEnum
{
OptionA,
OptionB,
OptionC,
};
Q_ENUM(MyEnum)
...
};
Example enum reference in qml is:
MyType.MyEnum.OptionA
The runtime reference works. Following the instructions here
https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html, even with the
QML_UNCREATABLE macro, the type could still not be resolved. Looking at
the qmltypes file, if the 'accessSemantics' for the type is changed to
'reference' from 'value' the linter works. Is this a problem with
linter, or possibly with the macro annotations of the type?
-- 'as' operator --
The 'as' operator has been used to deal with the 'missing-property'
warning in this type of pattern in QML
Loader {
id: loader
sourceComponent: Dialog { ... }
}
... {
(loader.item as Dialog).open()
}
This silences the linter, but at runtime there is an error, in this case
when the 'open()' function is called: 'TypeError: true is not a function'.
What is the status of the 'as' operator? It doesn't appear to be
documented. Can it be used, or does it have known short-comings?
Please also note the type registration is done manually, not with the
code generated by qmltyperegistrar. Any pointers would be appreciated.
Many thanks
Matthew Fincham
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest