In Qt, signals and slots require matching argument types:
QObject::connect: Incompatible sender/receiver arguments QLabel::linkActivated(QString) --> Butt
Default values for slot parameters helps very well. This allow to connect signals with different signatures to slot (vice versa to @pnezis answer):
private slots:
void slot( int x = 10, int y = 20, QString text = QString() );
may be connected to different signals:
signal1(int, int, QString)
signal2(int, int)
signal3(int)
signal4()
Also Qt 4.8 suggest useful QSignalMapper class:
This class collects a set of parameterless signals, and re-emits them with integer, string or widget parameters corresponding to the object that sent the signal.
But only for one parameter:
QSignalMapper* mapper = new QSignalMapper(this) ;
connect(action, SIGNAL(triggered()), mapper, SLOT(map())) ;
mapper->setMapping(action, "param value") ;
connect(mapper, SIGNAL(mapped(const QString &)),
this, SIGNAL(clicked(const QString &)));