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. How to know the slot connected to specific qobject&signal?
Qt 6.11 is out! See what's new in the release blog

How to know the slot connected to specific qobject&signal?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views 1 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Is it possible, given an object derived from qobject and a specific signal, to dynamically know the slot connected to that signal? How?!?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      -easiest way would be to have a look at the documentation of "QObject::connect(..)":http://qt-project.org/doc/qt-4.8/qobject.html#connect and to see there that connect() returns a boolean value.-

      Sorry misread your question

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        No problem :)

        This explanation maybe will help you to understand better my problem:

        I have a QAction connected through the triggered() signal to a given slot. I have to pass this QAction to another part of my program. This other module has to create a new QAction (it cannot be the one I passed) but that must be connected to the same slot when the triggered signal is emitted.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          QObject has a function "receivers":http://qt-project.org/doc/qt-4.8/qobject.html#receivers . Unfortunatly this only returns the number of receivers, but maybe if you have a look at the source code you can find a way?

          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