What are some best practices for debugging Qt signals and slots?

后端 未结 4 1864
青春惊慌失措
青春惊慌失措 2021-02-04 19:27

Debugging signals and slots can be hard, because the debugger does not jump to the slots of a signal when it is emitted. What are some best practices for debugging Qt signals an

4条回答
  •  既然无缘
    2021-02-04 19:51

    How do I make sure connections are set up successfully?

    You will see warnings in the console output from your application for each failed connection.

    When should I use signals and slots, when should I avoid them?

    In my opinion, it's fine to use them any time you want to maintain separation of concerns in your class design. Your class can emit a signal that may or may not be answered by another class (or classes) completely unknown to your class. This keeps your coupling down.

    What are the most efficient debugging techniques from your experience?

    I can't really add anything more than what is said on this blog post. 20 ways to debug Qt signals and slots

提交回复
热议问题