Guest User

Untitled

a guest
Oct 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class Cls_1 : public QThread
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. Cls_1();
  7. virtual ~Cls_1(){};
  8.  
  9. void Method_1(const double &param);
  10.  
  11. private:
  12. void run();
  13. };
  14.  
  15. Cls_1()::Cls_1()
  16. {
  17.  
  18. }
  19.  
  20. void Cls_1::run()
  21. {
  22. ...
  23.  
  24. exec();
  25. }
  26.  
  27. void Cls_1::Method_1(const double &param)
  28. {
  29. ;
  30. }
  31.  
  32. class Cls_2 : public QObject
  33. {
  34.  
  35. Q_OBJECT
  36.  
  37. public:
  38. Cls_2();
  39. virtual ~Cls_2(){};
  40.  
  41. void Method_1(const double &param);
  42.  
  43. signals:
  44. void SignalMethod_1(const double &param);
  45. }
  46.  
  47. Cls_2()::Cls_2()
  48. {
  49.  
  50. }
  51.  
  52. void Cls_2::Method_1(const double &param)
  53. {
  54. emit SignalMethod_1(param);
  55. }
  56.  
  57. Cls_1 *obj_1 = new Cls_1();
  58. obj_1->start();
  59.  
  60. _sleep(10000);
  61.  
  62. Cls_2 *obj_2 = new Cls_2();
  63.  
  64. QObject::connect(obj_2, &Cls_2::SignalMethod_1, obj_1, &Cls_1::Method_1, Qt::ConnectionType::DirectConnection);
  65.  
  66. obj_2->Method_1(1);
Add Comment
Please, Sign In to add comment