Hi,

in the context of (audio) plugin development, multiple users were running into the issue that they want to use QML in their plugin, but it would pick up import paths from the host application (which may or may not use Qt and is not under controls of the plugin author).

The accidental import path pick-up can happen rather easily given that
the QML_IMPORT_PATH environment variable is process global, and the engine will consider the "current directory" - which is resolved against the location of the executable, not of the plugin.

One proposed solution was to repurpose Qt::AA_PluginApplication to indicate that only a reduced set of standard import paths should be used,
namely qrc:/qt-project.org/imports and qrc:/qt/qml
(if you wonder whether there might still be a conflict on the qrc level: the plugin uses a separate, namespaced build of Qt, which means that it ends up with a "private" qrc file system).

Any additional import paths could still be added via QQmlEngine::addImportPath.

This would of course a breaking change, but we were wondering if anyone can think of a use case that would be negatively affected. Note that this won't affect all plugins, but only plugins which explicitly set Qt::AA_PluginApplication.


A few more comments/discussion points can be found at QTBUG-133312 and the linked patch.

Any opinions or pointers to existing users of QML together with Qt::AA_PluginApplication would be appreciated.

Kind regards,
Fabian Kosmale

--
Fabian Kosmale
Manager R&D

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin
fabian.kosm...@qt.io
+49 1638686070

--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to