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 error

QQuickImageProvider error

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 870 Views 2 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.
  • G Offline
    G Offline
    gabor53
    wrote on last edited by
    #1

    Hi,
    I am trying to implement a QQuickImageProvider class. My imageprovider.h:

    #ifndef IMAGEPROVIDER_H
    #define IMAGEPROVIDER_H
    
    #include <QQuickImageProvider>
    #include <QPixmap>
    #include <QObject>
    #include <QPainter>
    
    class ImageProvider : public QObject, public QQuickImageProvider
    {
        Q_OBJECT
    
    public:
       explicit ImageProvider(ImageType type, Flags flags = 0);
        QPixmap reqestPixmap(const QString &id, QSize *size, const QSize &requestedSize);
    
    };
    
    #endif // IMAGEPROVIDER_H
    
    

    My imageprovider.cpp so far:

    #include "imageprovider.h"
    
    ImageProvider::ImageProvider(ImageType type, Flags flags) : QQuickImageProvider (type, flags)
    {
    
    }
    
    

    When I build it I get the following error message:
    C:\Programming\Android\Samples\ClassTest\imageprovider.cpp:3: error: prototype for 'ImageProvider::ImageProvider()' does not match any in class 'ImageProvider'
    ImageProvider::ImageProvider()
    ^

    C:\Programming\Android\Samples\ClassTest\imageprovider.cpp:1: In file included from ..\ClassTest\imageprovider.cpp:1:0:

    C:\Programming\Android\Samples\ClassTest\imageprovider.h:11: error: candidates are: ImageProvider::ImageProvider(ImageProvider&&)
    class ImageProvider : public QObject, public QQuickImageProvider
    ^
    C:\Programming\Android\Samples\ClassTest\imageprovider.h:11: error: ImageProvider::ImageProvider(const ImageProvider&)
    C:\Programming\Android\Samples\ClassTest\imageprovider.h:16: error: ImageProvider::ImageProvider(QQmlImageProviderBase::ImageType, QQmlImageProviderBase::Flags)
    explicit ImageProvider(ImageType type, Flags flags = 0);
    ^
    How can I fix this error?
    Thank you for your help.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Looks like code is you pasted is not in sync with code you have ? I see 3 constructors errors in header files. You pasted only one. Please give us the complete code. It will help.

      Have you tried with code example given in the assistant. It is easy and work perfectly.

      class ColorImageProvider : public QQuickImageProvider
      

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      G 1 Reply Last reply
      0
      • dheerendraD dheerendra

        Looks like code is you pasted is not in sync with code you have ? I see 3 constructors errors in header files. You pasted only one. Please give us the complete code. It will help.

        Have you tried with code example given in the assistant. It is easy and work perfectly.

        class ColorImageProvider : public QQuickImageProvider
        
        G Offline
        G Offline
        gabor53
        wrote on last edited by gabor53
        #3

        Hi @dheerendra ,
        This is the entire code I have. It was originally 1 error message just got broken up when I copied.
        When I tried originally I used

        class ImageProvider : public QQuickImageProvider {
        public:
        ImageProvider ();
        }
        

        I got a message in the cpp file saying explicit definition is required.
        Thank you for your help.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Is this working now ? or still do you have problem ?

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          G 1 Reply Last reply
          0
          • dheerendraD dheerendra

            Is this working now ? or still do you have problem ?

            G Offline
            G Offline
            gabor53
            wrote on last edited by
            #5

            @dheerendra
            It is still not working.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              You likely didn't implement the ImageProvider constructor, did you ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Qt Champions 2022
                wrote on last edited by
                #7

                There are two options for you to check

                1. Under Qt Installation there is one example called Examples/Qt-5.11.0/quick/textureprovider
                  Please check this works or not.
                2. Go to Qt Assistant. There is one example in the QQuickImageProvider documentation. Copy-Paste the example. Just if this works.

                Both should work. If does not work, then we have different issue to solve than QQuickImageProvider issue.

                Dheerendra
                @Community Service
                Certified Qt Specialist
                http://www.pthinks.com

                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