Qt自定义MessageBox
QMessageBox *msgBox = new QMessageBox();
msgBox->setIcon(QMessageBox::Warning);
msgBox->setWindowTitle(codec->toUnicode(“警告”));
msgBox->setText(codec->toUnicode(“确定是否删除!”));
QPushButton *btn1 = msgBox->addButton(codec->toUnicode(“确定”),QMessageBox::AcceptRole);
btn1->setMinimumWidth(50);
QPushButton *btn2 = msgBox->addButton(codec->toUnicode(“取消”),QMessageBox::RejectRole);
btn2->setMinimumWidth(50);
msgBox->setWindowFlags(Qt::WindowStaysOnTopHint);
msgBox->exec();
if(btn1 == msgBox->clickedButton())
{
do();
}