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. Building a Qt Image Plugin throws "invalid new-expression of abstract class type 'ArgbHandler'" error
Forum Updated to NodeBB v4.3 + New Features

Building a Qt Image Plugin throws "invalid new-expression of abstract class type 'ArgbHandler'" error

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 7.2k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Did you implement both read and canRead in ArgbHandler ?

    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
    • H Offline
      H Offline
      Hans
      wrote on last edited by
      #3

      Hi,
      thanks for your help. :)

      I will put the code to pastbin so it is easier to read.

      http://pastebin.com/8hc1Fv5g
      http://pastebin.com/DGxztH81
      http://pastebin.com/DuRkrkva
      http://pastebin.com/bpV8hgkC

      http://pastebin.com/jcdQgw4c

      I think read and canRead are put in properly.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hans
        wrote on last edited by Hans
        #4

        Here I also uploaded the whole source.

        http://www.file-upload.net/download-10397238/ARGB2.zip.html

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

          canRead is not implemented nor called properly

          It isn't a static function (which you can't override by the way)

          bool ArgbHandler::canRead() const
          {
              return device()->peek(4) == "\xCA\xFE\x12\x34";
          }
          
          class ArgbHandler : public QImageIOHandler
          {
          public:
              ArgbHandler();
              ~ArgbHandler();
          
              bool read(QImage *image);
              bool write(const QImage &image);
          
              bool canRead() const;
          
              QVariant option(ImageOption option) const;
              void setOption(ImageOption option, const QVariant &value);
              bool supportsOption(ImageOption option) const;
          };
          

          which builds properly, however, I haven't done any run tests. You would also need to correct ArgbPlugin::capabilities for your plugin to build properly

          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
          • H Offline
            H Offline
            Hans
            wrote on last edited by
            #6

            Hi,
            thanks for your quick answer.

            I could also compile it. My intension for the plugin was to get support for the OpenEXR file format in qt. I compiled the OpenEXR libs but i have not found a good tutorial how to finally connect them with the compiled plugin so I can load exr files as a QImage.

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

              Do you mean get the data from an OpenEXR image in QImage or use the plugin ?

              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
              • H Offline
                H Offline
                Hans
                wrote on last edited by
                #8

                yes, basically I want to load an OpenEXR image in QImage. The format is not supported. Therefore I wanted to use the plugin.

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

                  Sorry, I meant, do you have problem getting the plugin to load ? Or do you have problem to read images from an OpenEXR file ?

                  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
                  • H Offline
                    H Offline
                    Hans
                    wrote on last edited by
                    #10

                    The plugin is loading correctly. I created a new simple QT app there i created a QImage.

                    I add the plugin via: QCoreApplication::addLibraryPath("some_path/plugins");

                    The app runs without an error.

                    But my problem is how can read an Open EXR image now. I guess I have to include the Openexr libs and use some special code for exr?

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

                      Yes, you will need to convert your EXR images in something supported by QImage

                      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

                      • Login

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