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 do you display a signal/slot graph ?

How do you display a signal/slot graph ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 2.0k 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.
  • M Offline
    M Offline
    Maxime Chambonnet
    wrote on last edited by Maxime Chambonnet
    #1

    cf. https://github.com/doxygen/doxygen/issues/7505

    I would like to see in such graph :

    • classes as vertices
    • members emitting signals as edge start
    • signals as directed edges
    • slots as edge end

    At this point I am thinking doxygen -> (needs doxygen work afaik) xml -> xlst -> pgmodeler rendering (the initial need is for PgModeler circle complete...).

    Related needs :
    https://www.qtcentre.org/threads/10460-Signal-and-slot-connection-graph
    https://stackoverflow.com/questions/4296464/visualize-qt-signals-and-slots
    https://ilyasivkov.wordpress.com/2015/03/08/signal-slot-diagram-using-doxygen-and-xslt/
    https://github.com/robertknight/Qt-Inspector/issues/20
    (KDAB Gammaray is not suitable here.)

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I'm not sure I understand. Do you want that statically or at a point in runtime? You do know that connections are dynamic and change over the course of program run? It's not possible statically. Just looking for connect statements in the source code is not anywhere near enough.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Maxime Chambonnet
        wrote on last edited by Maxime Chambonnet
        #3

        I want it statically, Gammaray already does the dynamic part.
        It looks definitely possible to me, notwithstanding instances, to reason over abstractions. Making this graph needs parsing the signal and slot definitions, the connect statements, the members in which the emits are done. Lambda slots are the corner case, and members where the connect happens could be displayed as receivers.

        Chris KawaC 1 Reply Last reply
        0
        • M Maxime Chambonnet

          I want it statically, Gammaray already does the dynamic part.
          It looks definitely possible to me, notwithstanding instances, to reason over abstractions. Making this graph needs parsing the signal and slot definitions, the connect statements, the members in which the emits are done. Lambda slots are the corner case, and members where the connect happens could be displayed as receivers.

          Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Maxime-Chambonnet said in How do you display a signal/slot graph ?:

          Making this graph needs parsing the signal and slot definitions, the connect statements, the members in which the emits are done

          That's the thing - those are dynamic and impossible to know statically.

          auto signal_name = get_string_from_some_database()
          auto slot name = get_string_from_internet();
          auto src = get_object_from_db_as_QObject();
          auto dst = get_object_from_dynamically_loaded_lib_as_QObject();
          
          connect(src, signal_name, dst, slot_name);
          

          What graph and for what class would you generate here?

          Even if you could get an information like that (which you simply can't statically) what's the worth? You have a 100 buttons in your app and one is connected to one of a 100 checkboxes. What would a line QPushButton ----> QCheckbox tell you about that app? Absolutely nothing. You don't know which button to which checkbox and at what time. It's useless.

          1 Reply Last reply
          2
          • M Offline
            M Offline
            Maxime Chambonnet
            wrote on last edited by Maxime Chambonnet
            #5

            You are right that, beyond what I thought to be a corner case, there is a wall of the impossible for static analysis.

            There is still a need, echoed by the various demands up there, by developers to get a better understanding, with high-level illustrations, of their applications.
            I face communications for my part that are pretty intertwined, and I could use visual debugging.

            I will bet that, in a Pareto way, a majority of code bases have signalling that can be analyzed statically.
            A QPushButton ----> QCheckbox line is most likely noise indeed, and yet you can often grab class name if any, widget name or object name, at compile time and why not squeeze a tiny bit of interesting information.
            One can think of heuristics to get rid of the noise, because they search and rightfully expect to find valuable intel in such graphs.

            Chris KawaC 1 Reply Last reply
            0
            • M Maxime Chambonnet

              You are right that, beyond what I thought to be a corner case, there is a wall of the impossible for static analysis.

              There is still a need, echoed by the various demands up there, by developers to get a better understanding, with high-level illustrations, of their applications.
              I face communications for my part that are pretty intertwined, and I could use visual debugging.

              I will bet that, in a Pareto way, a majority of code bases have signalling that can be analyzed statically.
              A QPushButton ----> QCheckbox line is most likely noise indeed, and yet you can often grab class name if any, widget name or object name, at compile time and why not squeeze a tiny bit of interesting information.
              One can think of heuristics to get rid of the noise, because they search and rightfully expect to find valuable intel in such graphs.

              Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Maxime-Chambonnet You might disagree, but I'd guess for an average-sized application you could get maybe 60% of the information statically, some of which would be false positives and a signal to noise ratio of about 1:100.

              The only place I could see this useful is if you have an app with just single instance of each class and all connections declared obviously in the code and living throughout the entire span of the runtime. That's like no application I've seen in my career beyond some basic tutorials and hello world ones.
              I mean even simple stuff like QMetaObject::connectSlotsByName can't be seen through this way.

              and yet you can often grab class name if any, widget name or object name, at compile time and why not squeeze a tiny bit of interesting information.

              If you're at runtime you can just put a breakpoint and inspect all the connections of that instance. What benefit would a line on a class graph give you? You already have that information and a lot more, a context of it, objects involved and a point in time.

              1 Reply Last reply
              2
              • M Offline
                M Offline
                Maxime Chambonnet
                wrote on last edited by Maxime Chambonnet
                #7

                I won't disagree because I haven't this experience.
                This is not really about breakpoints, more about time sequences, and akin to how you can loose hair over race conditions.
                I experimented with Valgrind and Gammaray all day. If gammaray provided a handy way to spot signal chains, well a signal graph, between user-defined sets of objects, rewind/replay them, with much more and better structured information, with glimmers of emitter member + receiver slot... I would not even consider static analysis.
                I guess I'll look at better understanding / improving gammaray then :), thanks.

                1 Reply Last reply
                1
                • W Offline
                  W Offline
                  wrosecrans
                  wrote on last edited by
                  #8
                  This post is deleted!
                  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