State of QSignalMapper



  • Hi all,

    while investigating the possibility to enhance QSignalMapper with support for QVariant mapping, I came across this ticket: https://bugreports.qt-project.org/browse/QTBUG-4035

    Unfortunately, I cannot quite concur with the conclusion that QSignalMapper has become useless with the introduction of lambdas. There are still scenarios - for example when working with plugins - where one doesn't have access to the class method address --and thus needs to rely on the const char* notation derived from the SIGNAL() macro, rendering the connect() signature using a lambda unavailable.
    Additionally, although I'm a big fan of lambdas myself, I expect that some teams doing cross-platform development may be reluctant to adopt to C++11 usage for some time.
    Having said that, I'd be willing to create a patch and pull request for QSignalMapper to support QVariant, but that wouldn't make sense if you decide to deprecate it, in which case I'd do the mapping locally.

    All the best
    Marcus


  • Lifetime Qt Champion

    Hi,

    I think you have a valid point. If you have a solution for that feature request, you should go ahead and make the patch (start by Qt 5 then cherry-pick for Qt 4).

    Nobody said QSignalMapper will be deprecated

    Happy coding !


Log in to reply
 

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