i want to do this:
connect(leftButton, SIGNAL(clicked()), this, SLOT(check(25));
connect(rightButton, SIGNAL(clicked()), this, SLOT(check(50));
why slot don't call with 25 or 50 ?
Printable View
i want to do this:
connect(leftButton, SIGNAL(clicked()), this, SLOT(check(25));
connect(rightButton, SIGNAL(clicked()), this, SLOT(check(50));
why slot don't call with 25 or 50 ?
You can't do that because signal and slot must have the same signature (number and type of parameters).
A little "exception" is that a slot may have a shorter signature than the signal it receives because it can ignore extra arguments.
More importantly, you can't pass arguments in the connect statement - only argument types. Trying to pass those integers is an error.
Look up QSignalMapper!
It can pick up a parameterless signal from a specified object and re-emit it with an int, const QString &, QWidget* or QObject* parameter.