QQmlExtensionPlugin : C++ constructor called but no QML component created



  • Hi,

    I'm trying to figure out how QQmlExtensionPlugin works.

    I created a plugin which derives from this class (called Button) which I import with QQmlEngine::importPlugin();
    The uri is now registered and I can instantiate it in other QML documents.

    If I do, the C++ constructor is called, but no QML component is created.

    If I understand correctly, I need to specify this in the qmldir file. But I'm confused where exactly this needs to point to. Ideally this would refer to a resource, since I would like to keep everything within the plugin.

    This is my resource file:

    @
    <RCC>
    <qresource prefix="/button">
    <file alias="Button">Button.qml</file>
    </qresource>
    </RCC>
    @

    And this is my qmldir file

    @
    module Button
    Button 1.0 /button/Button.qml
    @

    but to no avail.

    Thanks for reading


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.