#include <QMessageBox>
#include <QDebug>
#include <QTextCodec>
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForLocale(codec);
QTextCodec::setCodecForTr(codec);
int ret = QMessageBox::warning(this, QString("警告"),
QString("this is a warning!"),
QString("确定"), QString("取消"), 0, 1);
if (ret == 0){
qDebug() << "确定";
}else{
qDebug() << "取消";
}