Details
-
Suggestion
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.2.2
-
None
-
Windows. x64. Visual Studio 2109. Debug
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.