我有比较别致的方法 是对于不仅仅是一种控件进行判断的
你可以借鉴一下 这是我程序的一部分 是通过对象名来判断的
QObject *qob=qobject_cast<QObject*>(sender());
QString fileName=QFileDialog::getOpenFileName(
this,
"open file",
"/",
"allfile(*.*)"
);
if (qob->objectName()==ui.browseleft_button->objectName()||qob->objectName()==ui.action_Open_Left_Video->objectName())
ui.inputright->setText(fileName);
else if (qob->objectName()==ui.browseright_button->objectName()||qob->objectName()==ui.action_Open_Right_Video->objectName())
ui.inputleft->setText(fileName);
[ 此贴被wu9961在2008-11-24 11:45重新编辑 ]