Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. ====== C++ CODE ======
  2. Q_PROPERTY(QString test READ test NOTIFY testChanged)
  3.  
  4. Q_SIGNAL void testChanged();
  5. QString test() const {
  6. return "I am a property";
  7. }
  8.  
  9. Q_INVOKABLE QString test(QString param) const {
  10. return QString("I am a function and my parameter is '%1'").arg(param);
  11. }
  12.  
  13. =========== QML CODE ===========
  14. console.log("AppSettings test property:", appSettings.test);
  15. console.log("AppSettings function:", appSettings.test("Hello"));
  16.  
  17. =========== QML OUTPUT =========
  18. AppSettings test property: I am a property
  19. 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