Public functions versus public slots

前端 未结 5 1162
情话喂你
情话喂你 2021-01-02 07:45

In my one year of Qt programming, I have learnt a lot about signals and slots. But not enough...

http://doc.qt.io/qt-5/signalsandslots.html

S

5条回答
  •  温柔的废话
    2021-01-02 07:52

    For certain functions, you need a return value. This will not work as easily in slots. In slots you cant use the return value of a function or give a reference parameter to them. Yes you can do it, but you have a timing Problem. Whether you're using a slot or a normal member function dependents on your software architecture.

    In addition, slots run in the event loop. It depends on your code if this is intentional or not.

提交回复
热议问题