Qt::sender()
// 通过指针绑定槽函数
Button *createButton(const QString &text, const char *slotFunc) { Button *button = new Button(text); connect(button, SIGNAL(clicked()), this, slotFunc); return button; } Button *pointButton = createButton(tr("."), SLOT(pointClicked())); //多个控件绑定同一个槽函数,使用sender()获取发送者 Button *clickedButton = qobject_cast<Button *>(sender()); QString clickedOperator = clickedButton->text();