QSignalMapper 可能就是你想要的
The QSignalMapper class is provided for situations where many signals are connected to the same slot and the slot needs to handle each signal differently.
Suppose you have three push buttons that determine which file you will open: "Tax File", "Accounts File", or "Report File".
In order to open the correct file, you use QSignalMapper::setMapping() to map all the clicked() signals to a QSignalMapper object. Then you connect the file's QPushButton::clicked() signal to the QSignalMapper::map() slot.
signalMapper = new QSignalMapper(this);
signalMapper->setMapping(taxFileButton, QString("taxfile.txt"));
signalMapper->setMapping(accountFileButton, QString("accountsfile.txt"));
signalMapper->setMapping(reportFileButton, QString("reportfile.txt"));
connect(taxFileButton, &QPushButton::clicked,
signalMapper, &QSignalMapper::map);
connect(accountFileButton, &QPushButton::clicked,
signalMapper, &QSignalMapper::map);
connect(reportFileButton, &QPushButton::clicked,
signalMapper, &QSignalMapper::map);
Then, you connect the mapped() signal to readFile() where a different file will be opened, depending on which push button is pressed.
connect(signalMapper, SIGNAL(mapped(QString)),
this, SLOT(readFile(QString)));