Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQmlExtensionPlugin : C++ constructor called but no QML component created
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 573 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SQEW
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved