If you have a slot that accepts a reference like that:
void someSlot( const QString& ref );
void someSlot( const QString& ref );
To copy to clipboard, switch view to plain text mode
then you don't use reference when specifying type in the Q_ARG():
QMetaObject::invokeMethod( this,
"someSlot", Qt
::QueuedConnection, Q_ARG
(QString, someString
) );
QMetaObject::invokeMethod( this, "someSlot", Qt::QueuedConnection, Q_ARG(QString, someString ) );
To copy to clipboard, switch view to plain text mode
The important bit is the const in slot definition.
As wysota mentioned it's a copy of a string so there's no point in changing it.
Also when you register new type you don't register "SomeType&", just "SomeType".
Bookmarks