-
i have this warning, after update to Qt 6.0:
#ifndef COORD_2D_H #define COORD_2D_H #include <QObject> class coord_2d : public QObject { Q_OBJECT Q_PROPERTY(qreal x READ x WRITE setX) // <-- here Q_PROPERTY(qreal y READ y WRITE setY) // <-- here public: explicit coord_2d(QObject *parent = nullptr); void setX(qreal); qreal x(); void setY(qreal); qreal y(); private: qreal mX,mY; signals: }; #endif // COORD_2D_H
what's wrong? on Qt 5.12 it worked.
-
Hi,
Which OS are you running ?
Which compiler are you using ?
Can you show your .pro file ? -
I have the exact same problem after updating Qt 5.12.2. I am working with mingw 7.3_64 (win10). I don't have changed anything in my .pro between
Every property raises the warning, either in class with Q_OBJECT or with Q_GADGET.
In the warning tooltip, the expansion of the macro seems to be now:#define Q_PROPERTY(arg...) static_assert("Q_PROPERTY", #arg);
Which does not look good for defining property correctly.
Edit The include files does not seem to be coherent. If I follow the symbol, I get the right macro in file C:\Qt\Qt5.12.2\5.12.2\mingw73_64\include\QtCore\qobjectdefs.h. If I follow th the tooltip, I fall into C:\Qt\Qt5.12.2\Tools\QtCreator\share\qtcreator\cplusplus\wrappedQtHeaders\QtCore\qobjectdefs.h
-
Ok, after searching for a solution, it seems that it is linked with the update of QtCreator from 4.9 to 4.14. I have uninstalled everything and install from scratch version 5.12.3. Everything compiles fine, no warning. Then I launch MaintenanceTool and update to 4.14, and the warnings appear, compilation failed as the properties are not well defined.
This is not a solution. We are stuck with QtCreator 4.9, but big problems arise if we want to use external components (MaintenanceTool requests the update). -
@Benoit-Thouy Please elaborate "compilation failed as the properties are not well defined"
The warning is issued by the Clang Code Model and can be squelched by creating a new Diagnostic Configuration (or use your existing one) in Options...->C++->Code Model->Diagnostic Configuration and adding "-Wno-string-conversion" to it.