Guest User

Untitled

a guest
Apr 22nd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ....
  2. QQmlContext * context = new QQmlContext(engine.rootContext());
  3. context->setContextProperty("data", &data);
  4. QQmlComponent component(&engine, QUrl(strQmlPath));
  5. ....
  6.  
  7. Item {
  8. Connections {
  9. target: data
  10. onNewMessagePosted: window.visible = false
  11. }
  12. }
  13.  
  14. class MessageBoard : public QObject
  15. {
  16. Q_OBJECT
  17. public: void callMe () {
  18. emit newMessagePosted ();
  19. } ;
  20.  
  21. signals: void newMessagePosted ();
  22. };
  23.  
  24. ...
  25. engine.rootContext()->setContextProperty("data", &data);
  26. ...
Add Comment
Please, Sign In to add comment