消息对话框
//消息对话框
//1.错误对话框
QMessageBox::critical(this,"critical","错误");
//2.信息对话框
QMessageBox::information(this," info","信息");
//3.询问对话框 //返回值
if(QMessageBox::Save == QMessageBox::question(this," ques","询问",QMessageBox::Save|QMessageBox::Cancel,QMessageBox::Cancel))
{
qDebug() << "save";
}else {
qDebug() << "cancal";
}
//4.警告对话框
QMessageBox::warning(this," warning","警告");
其他标准对话框
// 颜色对话框
// QColor color = QColorDialog::getColor(QColor(255,0,0));
// qDebug()<< "r = "<<color.red() << "g = "<<color.green() << "b = "<<color.blue();
//文件对话框
// QFileDialog::getOpenFileName(this,"打开文件","D:\\Qt\\Image");
//过滤文档
//有返回值,是它的路径
// QString str = QFileDialog::getOpenFileName(this,"打开文件","D:\\Qt\\Image","(*.jpg)");
// qDebug() << str;
//字体对话框 返回值
// bool flag;
// QFont font = QFontDialog::getFont(&flag, QFont("华文彩云",50));
// qDebug() <<"字体:" <<font.family().toUtf8().data() << "字体大小:" <<font.pointSize() << "是否加粗:" <<font.bold() << "是否倾斜:" <<font.italic();