Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-74547

Provide API function for one-shot signal-slot connection

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.2
    • Core: Event loop
    • None
    • All

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            eudoxos eudoxos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes