Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Ulf Hermann via Interest
    void AddLogger(const QString& name, QObject* logger, QQmlContext* context)     {    logger->setParent(context);    QQmlEngine::setContextForObject(logger, context);    context->setContextProperty(name, logger);     } This is actually not a JavaScript global, but a conte

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Matthew Fincham via Interest
Hi Ulf Thanks for the feedback. The reason it was done like this is it was a simple replacement for console.log that didn't require any imports. So it would just work throughout the 50 odd modules and 1000 qml files. It was essentially added as an object in the engine's context (which is the

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Ulf Hermann via Interest
I was not going to add them to jsroot.qmltypes. I was wondering if there was a mechanism to extend what is defined in jsroot.qmltypes. That is pretty much the same thing. jsroot.qmltypes represents the JavaScript global object. Since all of this is pure JavaScript, we can generally not say muc

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Matthew Fincham via Interest
Hi Ulf I was not going to add them to jsroot.qmltypes. I was wondering if there was a mechanism to extend what is defined in jsroot.qmltypes. A singleton would work, but it would mean having to import the module and scope the function calls accordingly. We have a standard that says all impor

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Ulf Hermann via Interest
Another issue we are having with qmllint is adding type information for objects added to the global object in C++. We've used this to provide custom log and assert functions, but obviously the linter doesn't know about them. If they are added to qml/jsroot.qmltypes (along similar lines to the '

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-31 Thread Matthew Fincham via Interest
Hi I'm sorry for the burst of emails, and I'm not sure if this should be a new thread or not. Another issue we are having with qmllint is adding type information for objects added to the global object in C++. We've used this to provide custom log and assert functions, but obviously the linte

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Matthew Fincham via Interest
Hi Ulf Thank you for the response. This setup generates a qmllint warning, even in a skeleton QtCreator project. A bug report has been created: https://bugreports.qt.io/browse/QTBUG-116623 Kind regards Matthew On 2023/08/30 15:58, Ulf Hermann via Interest wrote: You can expose the type as b

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Ulf Hermann via Interest
You can expose the type as both a value type and a namespace: struct TestGadget { Q_GADGET QML_NAMED_ELEMENT(testGadget) Q_PROPERTY(int value MEMBER value) public: enum class GadgetEnum { OptionA, OptionB, OptionC, }; Q_ENUM(GadgetEnum) }; str

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Matthew Fincham via Interest
Hi Ulf Thank you for your response. -- QtLocation -- Thanks for catching this. See https://codereview.qt-project.org/c/qt/qtlocation/+/500504 for a fix. That's great, thank you. -- 'as' operator -- This should work. Type assertions (aka "as cast") are documented in https://doc.qt.io/qt-

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Ulf Hermann via Interest
Rule of thumb is "one module: one directory, one CMakeLists.txt + uri must follow source directory structure from project base". Im my experience any derivation from that rule causes pain and suffering ;-) Or maybe I still don't fully understand the IMPORTS, OPTIONAL_IMPORTS. DEFAULT_IMPORTS, DEPE

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Nils Jeisecke via Interest
Hi Matthew, On Wed, Aug 30, 2023 at 7:50 AM Matthew Fincham via Interest wrote: > We are in the process of integrating qmllint after migrating a project to > Qt6, and have hit a few issues. > ... > Please also note the type registration is done manually, not with the code > generated by qmltype

Re: [Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-30 Thread Ulf Hermann via Interest
Hi Matthew, -- 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 Thanks for catching this. See https://codereview.qt-project.org/c/qt/qtlocation/+

[Interest] Qt 6.5.2 and qmllint questions/issues

2023-08-29 Thread Matthew Fincham via Interest
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 Q