Guest User

Untitled

a guest
Jan 24th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. class test : public QObject{
  2. Q_OBJECT
  3. private:
  4. ...............................................
  5. public:
  6. test();
  7. public slots:
  8. void txt();
  9. signals:
  10. void ok();
  11. };
  12.  
  13. test::test(){
  14. ................................................
  15. connect(p, SIGNAL(clicked()), SIGNAL(ok()));
  16. }
  17.  
  18. void test::txt(){
  19. l->setText("ok");
  20. }
  21.  
  22. ....................................................
  23. test a, b;
  24.  
  25. QObject::connect(&a, SIGNAL(ok()), &b, SLOT(txt()));
  26. QObject::connect(&b, SIGNAL(ok()), &a, SLOT(txt()));
  27. ....................................................
  28.  
  29. class test : public QObject{
  30. Q_OBJECT
  31. private:
  32. ................................................
  33. public:
  34. test();
  35. public slots:
  36. void txt(QString);
  37. signals:
  38. void ok(QString);
  39. };
  40.  
  41. test::test(){
  42. ......................................................
  43. connect(p, SIGNAL(clicked()), SIGNAL(ok("word")));
  44. }
  45.  
  46. void test::txt(QString s){
  47. l->setText("ok");
  48. }
  49.  
  50. ....................................................
  51. test a, b;
  52.  
  53. QObject::connect(&a, SIGNAL(ok()), &b, SLOT(txt()));
  54. QObject::connect(&b, SIGNAL(ok()), &a, SLOT(txt()));
  55. ....................................................
  56.  
  57. connect(p, SIGNAL(clicked()), SIGNAL(ok("word")));
Add Comment
Please, Sign In to add comment