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

Support connect syntax with std::bind (makes QSignalMapper obsolete)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.5.0
    • Core: Object Model
    • None

    Description

      Currently it is possible to connect signals with lambda expressions. But it is still not possible to use std::bind like this:

      std::string str = "fixedValue";
      connect(myObj, &MyObj::sig, std::bind(&targetMethod, str, _1));
      

      Currently I use as workaround (because to use a new QSignalMapper for each connection is...)

      std::string str = "fixedValue";
      connect(myObj, &MyObj::sig, [&, str](int value) {targetMethod(str, value)});
      

      So it would be nice if std::bind is supported to increase readability of code (and this makes QSignalMapper obsolete).

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            EliteScience Heiko Thiel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes