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

Certain const-ref syntax not recognized by normalizedSignature()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.4.0
    • Core: Object Model
    • None
    • b881d8fb99972f1bd04ab4c84843cc8d43ddbeed

    Description

      If it is attempted to connected a signature for a function that takes a constant reference of a template type, and both the const and the reference is indicated at the end of the signature, Qt will fail to find the signal/slot. The moc tool will also generate incompatible signatures when it parses signatures with templates where the const-ref is at the end of the type signature.

      Example:

      The following works, the signature is correctly normalized:
      connect(myGraphicsScene, SIGNAL(changed(const QList<QRectF> &)), someObject, SLOT(someSlot()))

      The following also works, the signature is correctly normalized:
      connect(myGraphicsScene, SIGNAL(sceneRectChanged(QRectF const &)), someObject, SLOT(someSlot()))

      The following does not work:
      connect(myGraphicsScene, SIGNAL(changed(QList<QRectF> const &)), someObject, SLOT(someSlot()))

      You will get an error saying "No such signal 'changed(QList<QRectF>const&)'" because Qt has not removed the const-ref specifier.

      I believe the two syntaxes (const before and after the type) should be equivalent in this case.

      Also, maybe an even bigger issue: If you specify e.g. a signal as
      void mySignal(QList<QRectF> const &)

      then this will not be normalized in the meta object, so if you try to connect it to a slot declared as:
      void mySlot(const QList<QRectF> &)

      the connection will fail as Qt will not recognize the two type signatures as equivalent.

      Attachments

        Issue Links

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

          Activity

            People

              bhughes Bradley T. Hughes (closed Nokia Identity) (Inactive)
              esabraha Eskil Abrahamsen Blomfeldt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes