Qt: meaning of slot return value?

后端 未结 4 1593
粉色の甜心
粉色の甜心 2020-12-06 04:32

According to the documentation the return value from a slot doesn\'t mean anything.
Yet in the generated moc code I see that if a slot returns a value this value is used

4条回答
  •  一生所求
    2020-12-06 05:10

    It is Very useful when you deal with dynamic language such qtscript JavaScript QtPython and so on. With this language/bindings, you can use C++ QObject dinamically using the interface provided by MetaObject. As you probably know, just signals and slots are parsed by moc and generate MetaObject description. So if you are using a C++ QObject from a javascript binding, you will be able to call just slots and you will want the return value. Often Qt bindings for dynamic languages provides some facility to acces to normal method, but the process is definitely more triky.

提交回复
热议问题