Ok, how's this:
( this happens in A, which presumably has access to B and also to C, D ... )
for( int i = 0; i != plugins.count(); ++i )
{
if( plugins[i]->tag() == objectB->currentTag() )
connect( objectB, SIGNAL( activatePlugin() ), plugins[i], SLOT( activate() ) );
}
for( int i = 0; i != plugins.count(); ++i )
{
if( plugins[i]->tag() == objectB->currentTag() )
connect( objectB, SIGNAL( activatePlugin() ), plugins[i], SLOT( activate() ) );
}
To copy to clipboard, switch view to plain text mode
Is this too simple? Does B has more than one signal that it needs to connect to more than one object?
Maybe this works:
for( int i = 0; i != plugins.count(); ++i )
{
if( plugins[i]->tag() == objectB->currentTag() )
connect( objectB, SIGNAL( objectB->currentTag()->toAscii()->constData() ), plugins[i], SLOT( activate() ) );
}
for( int i = 0; i != plugins.count(); ++i )
{
if( plugins[i]->tag() == objectB->currentTag() )
connect( objectB, SIGNAL( objectB->currentTag()->toAscii()->constData() ), plugins[i], SLOT( activate() ) );
}
To copy to clipboard, switch view to plain text mode
Here I assume that currentTag() returns a QString that also matches a signal name from B.
For example if C = GPS and D = radio and E = GPS and currentTag() = GPS, then, GPS() signal from B will be connected to the activate() slots from C and E.
Bookmarks