QMessageBox::StandardButton rb = QMessageBox::information(NULL, tr("Warnning!"), tr("The Application is running?"), QMessageBox::Yes|QMessageBox::No|QMessageBox::Ok); if (rb == QMessageBox::Yes) { qDebug( "exitadfad"); } //按钮显示中文 int num = QMessageBox::warning(this, tr("注意"), tr(" 是否写入??"), tr("是"), tr("否"),tr("test")); if(0==num) { qDebug() << num; //0对应“是” //1对应“否” //2对应下一个按钮,以此类推,可添加多个自定义按钮 }