How to reply to an emitter dynamicaly
-
Hello everybody,
I would like to know if inside a slot (the receiver) I can connect a signal to it in order to reply to it and then disconnect the signal after it has been emitted in order to manage an other client?Thank you very much for your shares.
Cheers
What I have in mind...
public slots:
void onReceived()
{
QObject * emitter = ... (I don't know how.... )
connect(this, SIGNAL(sigReply(args...), emitter, SLOT(onReply(args...));
// do something
emit sigReply(things...);
disconnect(this,SIGNAL(sigReply(args...), emitter, SLOT(onReply(args...));
} -
This post is deleted!
-
Hello everybody,
I would like to know if inside a slot (the receiver) I can connect a signal to it in order to reply to it and then disconnect the signal after it has been emitted in order to manage an other client?Thank you very much for your shares.
Cheers
What I have in mind...
public slots:
void onReceived()
{
QObject * emitter = ... (I don't know how.... )
connect(this, SIGNAL(sigReply(args...), emitter, SLOT(onReply(args...));
// do something
emit sigReply(things...);
disconnect(this,SIGNAL(sigReply(args...), emitter, SLOT(onReply(args...));
}@Azerty said in How to reply to an emitter dynamicaly:
I would like to know if inside a slot (the receiver) I can connect a signal to it in order to reply to it and then disconnect the signal after it has been emitted in order to manage an other client?
This sounds like weird design.
Are you doing some server - client connection?Anyway, there is
QObject::sender()which can be used inside slots to get the signal emittingQObject