In this document is explained that signals must have void as a return value, but what about slots? Since开发者_开发知识库 signals must not return anything, can I assume it is the same for slots as well?
Your slots can return a value.
However, if the slot is connected to a signal and called when the signal is emitted, the return value will be ignored.
But the slot is a normal member function and can be called like any other function. In this case, the return value can be used by the caller.
This is said in the document you link to :
Since slots are normal member functions, they follow the normal C++ rules when called directly.
精彩评论