If basically anything can be used as a slot for a signal in Qt (provided that the signatures are compatible), why would I ever want to declare a member function as a slot? Is declaring a member function as a slot really just a hold over from the pre-C++11 days?
It has indeed become a rare situation but there are still some uses to declaring methods as slots, if you want to use the SIGNAL()/SLOT() macros in a connection (aka string-based connection). For example:
QLineEdit and QTextEdit; they do not inherit one another but both have a textChanged signal and you could make a window where instances of the former or the latter are added dynamically to it..qml file.The cons of string-based connections (or I guess pros of functor-based connections) are listed in the same page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With