[Interest] qt_add_qml_module and not embedding QML files

Benjamin TERRIER b.terrier at gmail.com
Mon Oct 31 16:00:29 CET 2022


On Mon, 31 Oct 2022 at 10:48, Ulf Hermann via Interest <
interest at qt-project.org> wrote:

> > Is there a way to not embed QML files into the Qt resource system when
> > using qt_add_qml_module() ?
>
> We can only pre-compile files embedded into the resource file with
> qmlcachegen. That's why we strongly recommend using the resource file
> system. You can, of course still manually write your qmldir files and
> handle the build process manually like in Qt5. It's definitely not
> recommended, though.
>
This would only be used in debug/development mode, with qml
compilation/cachegen disabled.


> > Or at least, not generate the "prefer :/..." line in the qmldir file ?
>
> The "prefer" line is vital. If you drop it, the module still looks like
> it would use the pre-compiled code in the qrc system with all the nice
> optimizations you get from compiling functions and bindings to C++. Yet,
> the QML engine will actually load the files from the host file system
> and ignore all of the goodies. Don't do this.
>

I do not want the goodies in this case.
When building in release mode, of course I still want the goodies.
I just want to disable them in debug mode.


>
> > Having the prefer line makes it impossible to load QML files from disk,
> > preventing any kind of live reloading of QML.
>
> If you're using Qt Creator's "QML preview" feature, it should try to
> match your qrc paths to the source paths in your project. As the engine
> then runs in debug mode, it can live-replace the contents of the QML
> files. There is also a command line "qmlpreview" tool.
>
> If the QML preview feature somehow got broken in Qt6, please file a bug
> report. It is mostly used by Qt Design Studio, and Qt Design Studio
> likes to use "qmlproject" projects without cmake.
>
>
I cannot use qmlpreview, as I usually need to have the full application
running.


On Mon, 31 Oct 2022 at 10:48, Ulf Hermann via Interest <
interest at qt-project.org> wrote:

> > Is there a way to not embed QML files into the Qt resource system when
> > using qt_add_qml_module() ?
>
> We can only pre-compile files embedded into the resource file with
> qmlcachegen. That's why we strongly recommend using the resource file
> system. You can, of course still manually write your qmldir files and
> handle the build process manually like in Qt5. It's definitely not
> recommended, though.
>
> > Or at least, not generate the "prefer :/..." line in the qmldir file ?
>
> The "prefer" line is vital. If you drop it, the module still looks like
> it would use the pre-compiled code in the qrc system with all the nice
> optimizations you get from compiling functions and bindings to C++. Yet,
> the QML engine will actually load the files from the host file system
> and ignore all of the goodies. Don't do this.
>
> > Having the prefer line makes it impossible to load QML files from disk,
> > preventing any kind of live reloading of QML.
>
> If you're using Qt Creator's "QML preview" feature, it should try to
> match your qrc paths to the source paths in your project. As the engine
> then runs in debug mode, it can live-replace the contents of the QML
> files. There is also a command line "qmlpreview" tool.
>
> If the QML preview feature somehow got broken in Qt6, please file a bug
> report. It is mostly used by Qt Design Studio, and Qt Design Studio
> likes to use "qmlproject" projects without cmake.
>
> best regards,
> Ulf
> _______________________________________________
> 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/20221031/717fc4da/attachment.htm>


More information about the Interest mailing list