Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to register QQuickAsyncImageProvider
Qt 6.11 is out! See what's new in the release blog

How to register QQuickAsyncImageProvider

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 285 Views 1 Watching
  • 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.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by ocgltd
    #1

    I have created a QQuickAsyncImageProvider based image provider that I would like to use from my QML code, but at run time QML complains about "Invalid image provider"

    I already have a QQMLExtensionPlugin based class containing:

    void ImageProviderExtensionPlugin::registerTypes(const char *uri)
    {
        Q_UNUSED(uri);
    }
    
    
    void ImageProviderExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
    {
        Q_UNUSED(uri);
        engine->addImageProvider("orchestrator", new OrchestratorImageProvider);
    }
    

    and I reference the image in QML as: source: "image://orchestrator/myimage.png"

    What am I missing? Searching the Qt docs I see reference to creating a qmldir file (but I think that's just if I am creating an imageprovider as a lib). I also see another example that calls engine.addImageProvider but since I'm using a plugin class I don't think that's necessary.

    Can someone fill in the blank for me?

    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