Argument type for Qt signal and slot, does const reference qualifiers matters?

arguments, connection, qt, signals-slots, types

Solution

Qt checks a normalized signature, meaning

Normalization reduces whitespace to a minimum, moves 'const' to the front where appropriate, removes 'const' from value types and replaces const references with values.

Problem

For signal and slot of below type ``` signals: void textChanged(const QString &); public slots: void setText(const QString & text) ``` the type of argument of textChanged and setText seems to work invarable of const and &. Does the constant and reference qualification make any difference compared to just using QString ? ``` QObject::connect(a,SIGNAL(textChanged(QString)),b,SLOT(setText(QString))); QObject::connect(a,SIGNAL(textChanged(const QString &)),b,SLOT(setText(const QString &))); ``` EDIT: I did not notice the output window showing error messages when there is incompatible type being used in SIGNAL or SLOT. I thought the signal slot mechanism is capable of detecting argument type error at compile time.

Original source