c++ - How to emit signal through a few class objects in Qt? -
i have few classes: class - highest class, class b , class c initialized in class constructor. in class b constructor initialized class b1 , in class c constructor initialized class c1. c1 object , b1 object not see each other.
every time need send signal c1 class b1 class, connecting c1 , c, c , b, finally, b , b1. every time programm emitting signal in c1 class object, sending c class object b , b1. (on image) right qt way? or there better way that?
you add class c interface returns c1 , similar interface class b, too. after creating classes c , b, class ask c1 , b1 , connect c1's signal b1's slot.
or, if have lots of these kind of cases , don't want expose classes c1 , b1 a, create own signaling mechanism. kind of "post office" classes register receivers , classes send messages. in case, class b1 register receiver , class c1 send messages. c1 , b1 know nothing each other. post office class send c1's message b1. kind of "post office" class implemented using qt's signals , slots.
Comments
Post a Comment