Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Need something like Subscribe/Publish, but not knowing the publisher?
Forum Update on Monday, May 27th 2025

Need something like Subscribe/Publish, but not knowing the publisher?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 1.5k Views
  • 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.
  • F Offline
    F Offline
    fredrossperry
    wrote on last edited by
    #1

    I am looking for a way for an object to receive a message, without having to connect to the a potential sender. Like if you could call connect without providing the sender, and you'd get signals no matter who the emitter was. I work with an in-house framework that has this, and it's very handy. My particular use for this is a scroll area that contains MANY widgets, and I'd like my main window to get notified when any of them are clicked on. Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AlGrenadine
      wrote on last edited by
      #2

      Maybe use events ?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Are you thinking of something like a QSignalMapper ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fredrossperry
          wrote on last edited by
          #4

          I was hoping for something even simpler. As simple as
          to receive:
          subscribe ("some message", callThis)
          to send
          publish ("some message")

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            AFAIK, there's nothing like that currently

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fredrossperry
              wrote on last edited by
              #6

              thanks then. I wound up using a custom event. A little extra work, but it works.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Just remembered something, there was in the QtMobility module something about a Publish And Subscribe system. However I don't know whether it's usable in Qt 5 and applicable to your current application. But worth to take a look at

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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 Extensions
                • Unsolved