Congratulations to our 2022 Qt Champions!

Code completion for style singleton used as component

  • Hi,

    I'm using a singleton object in QML to style my Applications. This seems to be a broadly used technique and works well. The only problem I have with the approach is that I can't get code completion in many cases. Actually the only way I can get code completion to work, is using an Item instead of the mostly used QtObject as singleton and importing it with direct path.

    But as soon as I try to use the singleton not by a direct import of the path, but by specifying a QML2_INPUT_PATH or by using qmlRegisterSingletonType, i loose the ability of code completion. It still works to reference the values, so I can use the defined values and everythings compiles and runs fine and the defined color, size etc. is used. But its very unsatisfying to look up the exact names in the file all the time.

    Unitl now i tried using qmlRegisterSingletonType with direct HDD path and with qrc path, using qmldir with and without specifying a module and with and without qmltype info, using QtObject or Item. It works all the time, but only without code completion.

    Is this just not possible, or am i doing somehting wrong?

Log in to reply