In my code I am creating new objects of same type inside loop and connecting a signal to object slot. Here is my trial.
A * a;
QList<A *> aList;
int aCounter = 0;
while(aCounter < 2)
{
a = new A;
aList.push_back(a);
connect(this,SIGNAL(somethingHappened()),aList[aCounter],SLOT(doSometing()));
aCounter++;
}
When somethingHappened signal is emitted. Both objects slot is called. But I need to handle them seperately. Is it wrong to connect signal to a slot inside loop? If not how can I achieve my desire?