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();

 

posted @ 2021-12-21 21:01  osbreak  阅读(170)  评论(0编辑  收藏  举报