Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to reply to an emitter dynamicaly
Qt 6.12 LTS is out! See what's new in the release blog

How to reply to an emitter dynamicaly

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 415 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Azerty
    wrote on last edited by Azerty
    #1

    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...));
    }

    Pl45m4P 1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • A Azerty

        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...));
        }

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #3

        @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 emitting QObject

        • https://doc.qt.io//qt-6/qobject.html#sender

        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved