Re: Signals and Slots between two different classes
I'm dealing two classes right now, class A and class B. an instance of class A and B each communicated together with signals and slots quite well.
I am now attempting to have two other instances of class B; for my application to work, class A will need some way to send a signal to only one instance of class B as opposed to the case where there is just one instance; is there any efficient way to do this without creating a whole new set of signals/slots for A?
thanks.
Added after 49 minutes:
I think QSignalMapper is just what I was looking for.
I should be able to thank myself.
Re: Signals and Slots between two different classes
I do not understand what your problem. Signals and slots connect between instances and not classes. So no matter how many instances of the class B exists.
Re: Signals and Slots between two different classes
you can add a static member to class B for example static bool flag=false; then in constractor of class B add this implimentation:
Code:
if (flag==false)
connect(your signal and slot)
flag=true;
with this implimentation only first object created class B connect.
Have fun