How can I bind a functor WITH a receiver?



  • Here's what I need:
    I bind a functor to a sender like:
    @QObject::connect(sender, signal, functor);@
    But functor may use another QObject.
    I want another overload like:
    @QObject::connect(sender, signal, recver, functor);@
    "functor" is no relationship with recver, but this connection will be destroyed automatically when sender "or" recver is destroyed.
    Is this possible? or any other solution?

    Currently I use "destroyed" signal to remove connection manually, but it's ugly.



  • I read source code, and I think there is a way if I can modify Qt header files.
    But is there any solution without header files modified?

    I use this feature for my Lua-binding project at : https://github.com/tdzl2003/luaqt


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.