QMessageBox *box = new QMessageBox(QMessageBox::Information,"MessageTitle","MessageContent");
box->addButton("OK",QMessageBox::YesRole);
box->setWindowIcon(QIcon(":/img/img/camera.png"));
box->setStyleSheet("background-color: rgb(238, 238, 236);color: rgb(32, 74, 135);");
box->addButton(QMessageBox::Ok);
box->button(QMessageBox::Ok)->hide();
box->exec();
头文件
#include <QMessageBox>
#include <QPushButton>