开发者

QT signal and slot function signature

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜