@Regex_brave
Use lambdas (new style syntax) e.g. if you want to pass different parameters from signal to slot. Example:
// member variables QPushButton *pb1, *pb2
pb1 = new QPushButton(this);
pb1->setObjectName("PushButton #1");
pb2 = new QPushButton(this);
pb2->setObjectName("PushButton #2");
connect(pb1, &QPushButton::clicked, this, &MainWindow::pushButtonClicked);
connect(pb2, &QPushButton::clicked, this, &MainWindow::pushButtonClicked);
connect(pb1, &QPushButton::clicked, this, []() { qDebug() << "A button was clicked, but *still* do not know which button"; }); // lambda
connect(pb2, &QPushButton::clicked, this, []() { qDebug() << "A button was clicked, but *still* do not know which button"; }); // lambda
connect(pb1, &QPushButton::clicked, this, [this]() { pushButtonClicked(pb1); }); // lambda
connect(pb2, &QPushButton::clicked, this, [this]() { pushButtonClicked(pb2); }); // lambda
void MainWindow::pushButtonClicked(bool checked = false)
{
qDebug() << "A button was clicked, but do not know which button";
}
void MainWindow::pushButtonClicked(QPushButton *pb)
{
qDebug() << "Button was clicked, objectName:" << pb->objectName();
}