[Interest] static QQmlExtensionPlugin Qml Import confusion

mark diener rpzrpzrpz at gmail.com
Wed Dec 30 22:04:23 CET 2015


Hello:

Would someone have a recommendation on my QML import syntax for
importing a static plugin.

When I try to import the static Qml Extension it says that module
"Rpzplugin" is not installed.

The environment is OSX 10.11 and Xcode 7.2 and Qt 5.5.1, but I think
this problem is platform agnostic.

Below are a quick summary of the details.

2 sample projects are attached for anybody that wants to see the code.
Remember to edit the pro file to reflect your

The host application is linking properly with the static plugin:

QPluginLoader::staticPlugins().count() == 1

StaticPlugin: QJsonObject({"IID":"com.rpzrpzrpz","MetaData":{},"className":"QmlcirclePlugin","debug":true,"version":328961})

My qmldir file has:

module Rpzplugin
plugin circleplugin
classname QmlcirclePlugin

The QML plugin is declared as follows:

class Qmlcircle : public QQuickPaintedItem
{
    Q_OBJECT
    Q_DISABLE_COPY(Qmlcircle)
   ....
}

class QmlcirclePlugin : public QQmlExtensionPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "com.rpzrpzrpz")
public:
    void registerTypes(const char *uri);
};

void QmlcirclePlugin::registerTypes(const char *uri)
{
    qmlRegisterType<Qmlcircle>(uri, 1, 0, "Qmlcircle");
    qDebug() << "Register Types:" << uri << endl ;
}


Also, the registerTypes() function for the QmlExtensionPlugin never
generates any debug output upon program startup, so it seems like it
never registers with QML.

There must be some way to cause the registerTypes() function to trigger.

Happy new year qt.

md
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qmlcircle.zip
Type: application/zip
Size: 4593 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151230/7d0eb3ad/attachment.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcircle.zip
Type: application/zip
Size: 5318 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151230/7d0eb3ad/attachment-0001.zip>


More information about the Interest mailing list