QTransform Include conflict between QtGui and Qt3D

114 views Asked by At

I am using Qt 5.15.2 and the qmake build system for the project. I have included Qt3D by adding Qt += 3dcore 3drender in the .pro file.

When building the project, I get this error from qgeoprojection_p.h, line 121:

field 'm_itemToWindowTransform' has incomplete type 'QTransform'

As far as I know, the qgeoprojection_p.h file is having issues with resolving #include <QTransform> and its using the QTransform defined inside the Qt3D instead of the GUI component.

I have raised a Qt bug for this.

How to get past this and use Qt3D in my project?

1

There are 1 answers

0
vre On

Unfortunately Qt provides different classes with the same name in different packages. To resolve this issue you need to explicitely specify which one you want to use, i.e. instead of doing

#include <QTransform>

you need to include the package path in the include command

#include <Qt3DCore/QTransform>
#include <QtGui/QTransform>

and use Qt3DCore::QTransform and QtGui::QTransfrom in your code.