[Interest] Qt 6.5.2 and qmllint questions/issues

Matthew Fincham matthewf at cat.co.za
Thu Aug 31 14:27:42 CEST 2023


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 imports (bar a few exceptions) be imported with a namespace so the 
usage can easily be searched for. So where there is currently:

    clog(....)
    gassert(....)


There would need to be

    import Global AS GBL // or whatever name the module has

    GBL.Logger.clog(...)
    GBL.Assert.gassert(...)


Or at least something like that. While it's not terrible, its more noisy 
than the simple function calls. Is there no mechanism to tell the type 
system about global objects and types?

Many thanks
Matthew



On 2023/08/31 13:51, Ulf Hermann via Interest wrote:
>> 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 'Console' type) then the linter does know 
>> about the type.
>
> The point of the linker is to warn you about QML constructs we cannot 
> compile to C++. jsroot.qmltypes is supposed to only contain 
> information about types built into QtQml itself, so that we can make 
> strong assumptions about where to find the respective functionality 
> when generating C++ code. Please don't add anything to it.
>
> You should define singletons if you need to add globally accessible 
> functionality. A singleton can have methods, and access to a known 
> singleton can be compiled to C++.
>
> best regards,
> Ulf Hermann
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230831/3582918e/attachment.htm>


More information about the Interest mailing list