can i use a slot with return ? for example :
QObject::connect(sender, SIGNAL(finished()), receiver, SLOT(onprocessFinished()));
and the pnprocessFinished return a QString that be used later that is possible? if yes how it must be done ?
can i use a slot with return ? for example :
QObject::connect(sender, SIGNAL(finished()), receiver, SLOT(onprocessFinished()));
and the pnprocessFinished return a QString that be used later that is possible? if yes how it must be done ?
A slot can return a value, but the signal has to return the same type and it works for direct connection. You will get the returned value when you call emit
:
void A::foo() {
connect( this, SIGNAL(mySignal()), this, SLOT( mySlot() ) );
int var = emit mySignal(); // int mySignal()
qDebug() << var; // will print 12
}
int A::mySlot() {
return 12;
}
But, I don't think that is useful...