Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-100353

Cannot derive from QImage class

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.2.2
    • Image formats
    • None
    • Windows.  x64.  Visual Studio 2109.  Debug

    • Windows

    Description

      This code produces an error 

       

      #include <QObject>
      #include <QImage>
      class QtPhoto : public QImage
      {
          Q_OBJECT
      public:
          QtPhoto();
          ~QtPhoto();
      };
      Q_DECLARE_METATYPE(QtPhoto)
      Q_DECLARE_OPAQUE_POINTER(QtPhoto *)
      
      

       

      #include "QtPhoto.h"
      #include <QObject>
      #include <QImage>
      QtPhoto::QtPhoto()
      {
      }
      QtPhoto::~QtPhoto()
      {
      }
      
      

      Compile errors:

      2>QtPhoto.cpp
      2>moc_QtPhoto.cpp
      2>C:\Users\Roger\source\repos\Projects\ImageViewers\Tinta\x64\Debug\moc\moc_QtPhoto.cpp(81,28): error C2227: left of '->metaObject' must point to class/struct/union/generic type
      2>C:\Users\Roger\source\repos\Projects\ImageViewers\Tinta\x64\Debug\moc\moc_QtPhoto.cpp(89,20): error C2039: 'qt_metacast': is not a member of 'QImage'
      2>C:\Qt\6.2.2\msvc2019_64\include\QtGui\qimage.h(72): message : see declaration of 'QImage'
      2>C:\Users\Roger\source\repos\Projects\ImageViewers\Tinta\x64\Debug\moc\moc_QtPhoto.cpp(94,19): error C2039: 'qt_metacall': is not a member of 'QImage'
      2>C:\Qt\6.2.2\msvc2019_64\include\QtGui\qimage.h(72): message : see declaration of 'QImage'
      

      Replacing QImage with QObject in the header compiles correctly.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            doug_rogers Doug Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes