As far as I can see, if I deploy a plugin as an application level plugin, then I can deploy it as a zip. This allows me to break my qml into componentx.qml files. However, when I deploy my plugin as a project plugin, it looks like I am only allowed to use the single file project_name.qml. Is this correct?
Hi @Heather_Hillers currently this is correct. I will let @Mathieu_Pellerin answer in more depth.
Actually it is very much possible to use componentx.qml alongside project plugins. Fundamentally, the only difference between an app plugin and a project plugin is that with an app plugin we’ll look for plugin_name/main.qml to load it while for project plugins we look for the project_name.qml sidecar file. But then within that sidecar file you can import other components that are in separate .qml files.
Note that if you want to ship project plugins that rely on additional files, you’ll need to put these in a subdirectory and add the directory as an “attachment directory” in your project properties via the QField panel.
Ah! I did not know about the subdirectory and attachment directory requirement. I will try that and let you know. Thanks so much for the tip!
In order to make this work, you also have to go to qfield.cloud and click On demand attachment files download. I was a bit confused at first because on Ubuntu I was able to see the component without making this setting. Maybe that was a side effect.
For anyone who is interested in how this works, I have posted a demonstration and a bit of documentation to github: