The 3-arguments overload of connect() is error-prone / easy to misuse:
* it's easy to e.g. connect to a lambda, and capture local state in the
lambda. By not passing a receiver/context, the connection won't get
disconnected if the local state gets destroyed (effectively, it
creates a "dangling connection");
* in a multithread scenario, one may not realize that the connection is
forced to be direct. If the signal is emitted in another thread than
the one establishing the connection¹, then the functor will be invoked
in that other thread. (Not that "the thread establishing the
connection" has ever mattered, but again, this API is error-prone.)
Add a macro that allows users to disable the overload in their project.
I'm not going for deprecation because there's simply too much code
around that uses it.
[ChangeLog][QtCore][QObject] Added the QT_NO_CONTEXTLESS_CONNECT macro.
Defining the macro before including any Qt header will disable
the overload of QObject::connect that does not take a receiver/context
argument.
Change-Id: I86af1029c1a211ea365f417aae9038d3fcacadfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>