I'm trying to create an object for use for QML integration.
If I uncomment the marked code, I get compilation errors:
Qt Code:
// header #ifndef MY_QML_INTERFACE_H #define MY_QML_INTERFACE_H #include <QObject> #include <QDateTime> { Q_OBJECT public: /* THIS CODE WON't COMPILE Q_INVOKABLE QDateTime getCurrentDateTime() const { return QDateTime::currentDateTime(); */ signals: void singleValueChanged(); private: QString mSingleValue; }; #endif // Cpp #include "MyQmlInterface.h" { return mSingleValue; } { if (newSingleValue == mSingleValue) return; mSingleValue = newSingleValue; emit singleValueChanged(); }To copy to clipboard, switch view to plain text mode
Any idea why this doesn't work?
Bookmarks