Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.4.0
-
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
- is required for
-
QTBUG-3722 moc: When doing MyClass* const& as a signal/slot parameter then the code generated is invalid
-
- Closed
-