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. QQuickImageProvider - requestImage() not implemented
Forum Updated to NodeBB v4.3 + New Features

QQuickImageProvider - requestImage() not implemented

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 622 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.
  • metaDomM Offline
    metaDomM Offline
    metaDom
    wrote on last edited by metaDom
    #1

    Hey guys,

    I'm trying to pass a QImage to QML via QQuickImageProvider. Once QML requests the image I receive the following error:

    "(null):0 ((null)): ImageProvider supports Image type but has not implemented requestImage()"

    My provider looks as follows:

    source:

    #include "qmlimageprovider.h"
    
    QmlImageProvider::QmlImageProvider()
        :QQuickImageProvider(QQuickImageProvider::Image)
    {
    }
    QmlImageProvider::~QmlImageProvider()
    {
    }
    
    void QmlImageProvider::setPic(QImage cameraFrame)
    {
        this->cameraFrame = cameraFrame;
        emit cameraFrameReady();
    }
    
    QImage QmlImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize, bool requestedAutoTransform)
    {
        Q_UNUSED(id);
        Q_UNUSED(size);
        Q_UNUSED(requestedSize);
        Q_UNUSED(requestedAutoTransform);
    
        qDebug() << "Request Image";
    
        return this->cameraFrame;
    }
    
    

    header:

    #ifndef QMLIMAGEPROVIDER_H
    #define QMLIMAGEPROVIDER_H
    
    #include <QQuickImageProvider>
    #include <QDebug>
    
    class QmlImageProvider : public QObject, public QQuickImageProvider
    {
        Q_OBJECT
    
        public:
            explicit QmlImageProvider();
            ~QmlImageProvider();
    
            void setPic(QImage cameraFrame);
    
        protected:
            virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize, bool requestedAutoTransform);
    
        signals:
            void cameraFrameReady();
    
        private:
            QImage cameraFrame;
    };
    
    #endif // QMLIMAGEPROVIDER_H
    
    

    Thanks in advance!

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Shouldn't requestImage(...) be public?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      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