Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ====== C++ CODE ======
- Q_PROPERTY(QString test READ test NOTIFY testChanged)
- Q_SIGNAL void testChanged();
- QString test() const {
- return "I am a property";
- }
- Q_INVOKABLE QString test(QString param) const {
- return QString("I am a function and my parameter is '%1'").arg(param);
- }
- =========== QML CODE ===========
- console.log("AppSettings test property:", appSettings.test);
- console.log("AppSettings function:", appSettings.test("Hello"));
- =========== QML OUTPUT =========
- AppSettings test property: I am a property
- main.qml:39: TypeError: Result of expression 'appSettings.test' [I am a property] is not a function.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement