[Interest] Loading QML plugins without registered types

Oleg Shparber trollixx at gmail.com
Mon Oct 20 10:39:04 CEST 2014


My plugin [1] provides new functions on the global object. So, it only
needs QQmlEngine to export all of its stuff. It does not have any QML
types, but it is still meant to be used in QML only apps too.

1.
https://github.com/trollixx/node.qml/blob/master/src/imports/nodeqml/nodeqml_plugin.cpp

On Sun, Oct 19, 2014 at 11:51 PM, Bo Thorsen <bo at vikingsoft.eu> wrote:

> Den 19-10-2014 kl. 21:15 skrev Oleg Shparber:
> > I have a plugin which does not provide any QML types and needs only
> > initializeEngine() method to be executed. The problem is that the plugin
> > is not registered with QML Engine when it doesn't have any types. That
> > leads to an error with import statement:
> >
> > qrc:/main.qml:4 module "com.wisetroll.nodeqml" is not installed
> >
> > Right now I worked the problem around by registering a fake object:
> >
> > qmlRegisterType<QObject>(uri, 1, 0, "__nodeQmlUselessObject");
> >
> > I couldn't find any other way to make my plugin work. Am I missing a
> > proper way of loading plugins with no types?
> >
> > If there's no other way, my suggestion would be to add a new directive
> > to qmldir, that would tell QML engine to keep register plugin regardless
> > if it provides types or not.
>
> I guess people would have thought that any QML plugin would register
> types. If it doesn't do this, then it's not a QML plugin.
>
> I suspect that what you are doing here is to use the QML plugin system
> to load what is really a normal plugin for your C++ layer. In that case,
> you should use the standard Qt plugin system.
>
> If this isn't the case, please describe what you are doing and why you
> think it's the right idea to break the fundamental assumption of the
> plugin.
>
> Bo Thorsen,
> Director, Viking Software.
>
> --
> Viking Software
> Qt and C++ developers for hire
> http://www.vikingsoft.eu
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



-- 
Oleg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141020/bd1eeead/attachment.html>


More information about the Interest mailing list