槽函数里:

QObject *QObject::sender() const

返回值是QObject指针,也就是触发者,可能是按钮,可能是定时器。

如何得到触发对象:

QTimeEdit *editor = qobject_cast<QTimeEdit *>(sender());  
QObject *object = QObject::sender();
QCheckBox *pSenderCheckBox = static_cast<QCheckBox*>(object);

 

相关文章: