[Interest] Are slots even needed these days?
Nikos Chantziaras
realnc at gmail.com
Thu Mar 17 11:57:56 CET 2016
On 16/03/16 16:24, Nikos Chantziaras wrote:
> Since in modern Qt you connect signals to functions/lambdas, is there a
> reason to declare slots anymore? [...]
Good replies here. So, to sum it up, it seems that slot/signal
declarations and old-style connect() syntax will continue to have a
place in Qt due to:
* QML signals/slots.
* QObject runtime reflection (invokeMethod() as the most common use.)
* Easy dynamic connections (signal/slot names unknown at compile time.)
* Qt Designer automatic signal/slot connection generation.
* Easy overload resolution (but Qt 5.7 fixes that with qOverload().)
There's also code documenting issues, but these are subjective.
So I'll be keeping the signal/slot declarations. I was considering to
remove them for the next major version of one of my projects, but it
would be rather unfortunate to then have to re-introduce some of them
later on because I want to use QML or might need reflection capabilities.
So using PMF syntax but keeping the signal/slot declarations seems like
the way to go for me.
Thanks everyone for the helpful feedback! :-)
More information about the Interest
mailing list