1.方法一:
QMessageBox mess(QMessageBox::Question, "删除提示", "确认删除所选组件?", NULL);
QPushButton *okButton = mess.addButton(tr("确定"), QMessageBox::AcceptRole);
QPushButton *cancelButton = mess.addButton(tr("取消"),QMessageBox::RejectRole);
mess.exec();
if ((QPushButton*)mess.clickedButton() == okButton)
{
}
2方法二:
QMessageBox::warning(this,tr("test"), tr("msg"), tr("Yes"), tr("No"), tr("Cancel"));
然后翻译tr("Yes"), tr("No"), tr("Cancel")三个即可