1.
QMessageBox msgBox; msgBox.setText("LED测试"); msgBox.setIcon(QMessageBox::Question); msgBox.setInformativeText("当前LED显示为红色?"); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setButtonText (QMessageBox::Yes,QString("是")); msgBox.setButtonText (QMessageBox::No,QString("否")); msgBox.setDefaultButton(QMessageBox::Yes); int ret = msgBox.exec(); if(ret==QMessageBox::Yes) { qDebug()<<"QMessageBox::Yes"; } else { qDebug()<<"QMessageBox::no"; }