AutoMoc: The Property will be invalid
Solved
Qt 6
-
Hello. This is some of the other things that started to happen after Qt5=>Qt6 upgrade.
The source code is:
namespace WABAS::ViewModels { class CalibrationFilesView : public TableViewModel { Q_OBJECT Q_PROPERTY(int currentFileIndex WRITE setCurrentFileIndex) Q_PROPERTY(QAbstractTableModel* currentData READ currentData NOTIFY currentDataChanged) Q_PROPERTY(QString title READ title NOTIFY titleChanged)
The problem is:
warning: Property declaration currentFileIndex has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid.
-
You need a READ function according the docs: https://doc.qt.io/qt-6/properties.html
Q_PROPERTY(type name (READ getFunction [WRITE setFunction] | MEMBER memberName [(READ getFunction | WRITE setFunction)])
-
@Christian-Ehrlicher I tried now I got more errors:
return-statement with a value, in function returning ‘void’ [-fpermissive] 145 | return _currentFileIndex;
-
@Christian-Ehrlicher Okay I was able to fix it creating a function
currentFileIndex()
-