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

QObject::connect warns, but also fails to connect to lambdas with Qt::UniqueConnection

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • Core: Object Model
    • None
    • All
    • afddb327b (dev), fd6640006 (6.7), a40ca88b6 (6.6)

    Description

      Behavior breakage detected porting from Qt 6.2.3 to Qt 6.5.1:

      QObject::connect(myObject, &Object::mySignal, context, [](){}, Qt::UniqueConnection);
      

      Prior to Qt 6.5, the final parameter would be ignored / the connection would be established, but since the lambda is always unique I suppose the last argument made no sense.

      From 6.5, a useful warning is printed!

      WARNING: QObject::connect(<sender>, <receiver>): unique connections require a pointer to member function of a QObject subclass
      

      But the connection is no longer established, which breaks behavior.

      Attachments

        For Gerrit Dashboard: QTBUG-115125
        # Subject Branch Project Status CR V

        Activity

          People

            peppe Giuseppe D'Angelo
            andrhans Andreas Aardal Hanssen
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews