[Qt-interest] Mapping signals based on parameter value

Ender EREL erelender at yahoo.com
Wed Oct 14 11:18:37 CEST 2009


Hi folks,

I know that i can use QSignalMapper to call a slot with different 
parameters based on connection. What i want to achieve is a little 
different.

We are using plugins in our application and different plugins are 
responsible for different types of objects. We are connecting multiple 
slots, each implemented in a different plugin, to one signal emitted by 
the main application. One of the parameters of the signal is a QString 
indicating the type of object associated with the signal. Currently, we 
are checking this parameter in the slots and proceed if the type is 
handled by the plugin. This has a downside, every plugin does this 
checking and i want to avoid this if possible.

I want to connect all slots to the same signal, and when the signal is 
emitted, only the appropriate slot is called depending on the value of 
the QString argument, kind of like a QSignalMapper but in a different way.

Is there any built-in mechanism to do this? If not, any ideas on how i 
can achieve this?

Thank you in advance.

Best Regards.

-- 
Ender EREL



More information about the Qt-interest-old mailing list