[Interest] QML-plugins problems, pragmatic development questions

Alan Alpert 416365416c at gmail.com
Fri Sep 6 22:10:54 CEST 2013


I don't deploy on Windows, but on a related note when I deploy plugins
for my mobile apps I usually just set the QML2_IMPORT_PATH to my
application directory and install my plugins there. So the application
is run like "QML2_IMPORT_PATH=appdir appbinary" and the appdir looks
like:

appdir/appbinary
appdir/qml/main.qml
appdir/MyApp/Core/qmldir
appdir/MyApp/Core/libmyplugin.so

Which allows "import MyApp.Core 0.1" to find libmyplugin.so. I assume
the same approach would work for Win7 deployment (note that you can
also add import paths with a method on QQmlEngine instead of the
environment variable).

If you set the QML_IMPORT_TRACE environment variable then it spits out
where it's finding the modules, which might help with debugging.

--
Alan Alpert


On Fri, Sep 6, 2013 at 9:12 AM, Charley Bay <charleyb123 at gmail.com> wrote:
> I'm having a lot of trouble importing my C++ plugins into my QML files
> (Win7, Qt5.1.1).  With many configurations that I think "should" work, the
> "import MyPlugin 1.0" within a QML file generates the runtime error message
> (at the `qmlscene` command line, or within QtCreator):
>
> module "MyPlugin" is not installed
>
>
> Even though it would be great if I understood why my plugins won't load, my
> question(s) are strictly "pragmatic" as it relates to C++Plugin/QML
> development.
>
> I understand "deployment" is different from "development", and I understand
> some people have various issues with "QML-deployment-on-Win7" when it works
> for them during "development" (e.g., success only when running from within
> QtCreator, or only when running on the development machine with explicitly
> installed Qt).
>
> QUESTION:  How are you doing your plugin development -- What is your
> configuration across QtCreator projects?
>
> For example, I ASSUME I should run something like:
>
> *- [QtCreator Instance #1] with the "MyPlugin" project
>
> *- [QtCreator Instance #2] with the "MyQmlApp" that loads the "MyPlugin"
> binaries
>
> *- [BONUS] [QtCreator Instance #3] with shared-lib ("MyTypes.DLL") that is
> loaded by "MyPlugin" binaries in [QtCreator Instance #1]
>
> What is the reasonable way for the "MyQmlApp" project to successfully load
> the binary output from the "MyPlugin" project?  (Where is the
> common-configuration so they can reference build products across projects?)
> Do I somehow configure them to reference binaries across projects (into the
> "Debug" or "Release" sub-dirs), or do I "deploy" them to a common location,
> and their binary references are only as it relates to
> "deployed-configurations"?  (...which seems like more work during
> development iteration, as it adds an extra "deployment" step after each
> build step?)
>
> And, do people typically load "debug-versions" of their "plugins", when
> those are loaded into "debug-versions" of their
> "MyQmlApp-with-C++-compiled-code.exe"?  (How do you handle the additional
> level of indirection when you C++ plugin loads other C++ DLLs, and it would
> be nice to step into debug versions of those DLLs?)
>
> Regarding "why won't my plugins load?":
>
> Ideally, what I'd like is something like the "Creating C++ Plugins for QML"
> page at:
> http://qt-project.org/doc/qt-5.1/qtqml/qtqml-modules-cppplugins.html , but
> with a lot more specific details about *where* files are located (in what
> directories), exactly what they look like and how they are found, based on
> what "com.mycompany.mystuff" namespaces (at least a couple levels as
> examples), and similarly with "plugins" at these different namespace-levels
> (since the docs recommend that typically only a single plugin is identified
> with a single `qmldir` file, due to the costly load-time).
>
> An aside:  I agree with this thread on qt-project.org that deploying QML
> plugins on Win7 is, "too difficult":
> http://qt-project.org/forums/viewthread/25714
>
> It seems reasonable that this would be a "solved-problem" in Qt5.1, and
> could be codified into a more detailed tutorial that is very specific about
> where files are, and how they are found.
>
> Thanks for suggestions!
>
> --charley
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list