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. Slots & Signals - How can I avoid losing track of the control structure?
Forum Updated to NodeBB v4.3 + New Features

Slots & Signals - How can I avoid losing track of the control structure?

Scheduled Pinned Locked Moved Unsolved General and Desktop
pyside6best practicearchitecture
3 Posts 3 Posters 576 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.
  • D Offline
    D Offline
    dynobo
    wrote on last edited by
    #1

    Hi all,

    Beginner Qt (PySide6) developer here, I hope my question is not too silly.

    When I develop a Qt app with multiple components, I tend to lose track of the slots and signals, when they are triggered and where they get consumed. I think there are two aspects that make it more difficult for me than in my previous coding projects:

    1. I find it cumbersome to identify the slots associated with a signal and vice versa. For "normal" functions or methods, my IDE (vscode) supports me very well in finding their references, but for slots/signals I resort to a simple full-text search in the codebase.

    2. Also, my components seem to be more interconnected than other classes/modules I write. E.g. circular dependencies between modules are prohibited in Python, but with Qt it sometimes seems hard to avoid them. Perhaps this is already one of my antipatterns?

    Do you have any recommendations (or resources like blog posts, docs, etc.) that can help a beginner like me avoid a mess and keep Qt code structured? If they are Python centered, even better!

    Thanks a lot!

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

      Hi,

      If you have circular dependencies in your Qt code, it likely means that you are doing something wrong. From experience, I would say that your objects are knowing way too much about each other. A class that has signals shall not care nor know who is consuming its signals. That's not its role.

      For your signal slot tracking issue, are you annotating them properly ?

      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
      1
      • D dynobo

        Hi all,

        Beginner Qt (PySide6) developer here, I hope my question is not too silly.

        When I develop a Qt app with multiple components, I tend to lose track of the slots and signals, when they are triggered and where they get consumed. I think there are two aspects that make it more difficult for me than in my previous coding projects:

        1. I find it cumbersome to identify the slots associated with a signal and vice versa. For "normal" functions or methods, my IDE (vscode) supports me very well in finding their references, but for slots/signals I resort to a simple full-text search in the codebase.

        2. Also, my components seem to be more interconnected than other classes/modules I write. E.g. circular dependencies between modules are prohibited in Python, but with Qt it sometimes seems hard to avoid them. Perhaps this is already one of my antipatterns?

        Do you have any recommendations (or resources like blog posts, docs, etc.) that can help a beginner like me avoid a mess and keep Qt code structured? If they are Python centered, even better!

        Thanks a lot!

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @dynobo Starting a reply with " I am in same boat" is a cliche and it does not help (you) .
        I have half a dozen "objects" passing messages - both directions and using "emit" and "connect".

        I am using GUI / tab to keep track and of course QDebug.
        It is not ideal ....

        I was going to add old fashioned flowchart ( text or GUI ) , but got sidetracked....

        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