Qt4学习笔记(七),QMessageBox对话框



#include <QtGui/QApplication>
#include <QMessageBox>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	//关于消息框
	QMessageBox::about(NULL, "this title", "this QMessageBox::about");
	
	//关于Qt消息框
	QMessageBox::aboutQt(NULL);
	
	//提示消息框
	QMessageBox::information(NULL, "this title", "this QMessageBox::information", 
		                     QMessageBox::Yes, QMessageBox::No);
	
	//询问消息框,有返回值
	QMessageBox::question(NULL, "this title", "this QMessageBox::question", 
		                  QMessageBox::Yes, QMessageBox::No);
	
	//警告消息框,有返回值
	QMessageBox::warning(NULL, "this title", "this QMessageBox::warning", 
		                 QMessageBox::Yes, QMessageBox::No);
	
	//致命错误消息框,有返回值
	QMessageBox::critical(NULL, "this title", "this QMessageBox::critical", 
		                  QMessageBox::Yes, QMessageBox::No);
	
	return a.exec();
}

运行结果:







猜你喜欢

转载自blog.csdn.net/u012592062/article/details/80380554