Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.2
-
None
Description
Occasionally, a legitimate need for creating one-shot connection arises – a QObject::connect which will be disconnected after the first dispatch. There are several posts about how this should be implemented by users. Due to various corner-cases (such as some kind of helper object being stale if a connection is deleted due to one of the endpoints being deleted), those solutions are either overly complicated or incomplete.
This is a question a recent (my own) question at SO https://stackoverflow.com/questions/55000571/qt5-one-shot-connection-to-lambda/55198427#55198427 asking for contemporary (c++11, supporting lambdas and such) solution.
Supporting this functionality in Qt API itself (e.g. by adding a Qt::OneshotConnection bit to Qt::ConnectionType) would make respective tasks less verbose, more future-proof and higher-quality.