当前位置: 首页 > news >正文

兰州网站制作服务电话百度站长平台账号购买

兰州网站制作服务电话,百度站长平台账号购买,做网站的什么行业好出单,源码网站开发本文介绍Qt消息对话框的使用。 QMessageBox类是Qt编程中常用到的一个类,主要用来进行一些简单的消息提示,比如:问题对话框,信息对话框等,这些对话框都属于QMessageBox类的静态方法,使用起来比较简单&#…

本文介绍Qt消息对话框的使用。

QMessageBox类是Qt编程中常用到的一个类,主要用来进行一些简单的消息提示,比如:问题对话框,信息对话框等,这些对话框都属于QMessageBox类的静态方法,使用起来比较简单,方便。

1."information"对话框

函数原型:

QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = Ok, QMessageBox::StandardButton defaultButton = NoButton)

其中,

parent:指定父窗口

title:对话框标题

text:显示内容

buttons:显示哪些按钮,可以采用"|"方式进行组合,如同时显示"Yes","No"2个按钮可以采用:"QMessageBox::Yes | QMessageBox::No"进行组合,相见"QMessageBox"描述

defaultButton:默认显示哪个按钮,如默认显示"Yes"按钮,可以采用:"QMessageBox::Yes"

返回值:

QMessageBox::StandardButton

因对话框为模态对话框,执行到这里会阻塞,这里可以通过返回值来进行分支处理,如:

    int ret = QMessageBox::information(this, "information", "information message box test", QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);if (ret == QMessageBox::Ok) {qDebug() << "Ok";} else {qDebug() << "Cancel";}

注意:弹出的对话框"X"按钮对应的返回值为"RejectRole"类型的那个按钮功能。

2."question"对话框

函数原型:

QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = StandardButtons(Yes | No), QMessageBox::StandardButton defaultButton = NoButton)

参数含义和1类似。

3."warning"对话框

函数原型:

QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = Ok, QMessageBox::StandardButton defaultButton = NoButton)

参数含义和1类似。

4."critical"对话框

函数原型:

QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = Ok, QMessageBox::StandardButton defaultButton = NoButton)

参数含义和1类似。

5."about"对话框

函数原型:

void QMessageBox::about(QWidget *parent, const QString &title, const QString &text)

参数含义和1类似,只是没有按钮。

6."aboutQt"对话框

函数原型:

void QMessageBox::aboutQt(QWidget *parent, const QString &title = QString())

参数含义和1类似,只是没有按钮和标题。

7.自定义消息对话框

以上介绍对话框都是固定的方式呈现的,缺乏灵活性,有时候也可以根据需要自定义消息对话框。如:

    QMessageBox msgBox;msgBox.setWindowTitle("message box");msgBox.setText(tr("message boxt test"));msgBox.setInformativeText(tr("Yes or No?"));msgBox.setDetailedText(tr("detail"));msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);msgBox.setDefaultButton(QMessageBox::Yes);msgBox.setModal(true);int ret = msgBox.exec();switch (ret) {case (QMessageBox::Yes): {qDebug() << "Yes";break;}case (QMessageBox::No): {qDebug() << "No";break;}default:{break;}}

更多的QMessageBox方法可以参见Qt的Help文档,这里就不细说了。

显示效果如图:

总结,本文介绍了Qt消息对话框的使用。


文章转载自:
http://abbevillian.c7629.cn
http://matronlike.c7629.cn
http://semisocialist.c7629.cn
http://stator.c7629.cn
http://universalise.c7629.cn
http://stipulation.c7629.cn
http://fertilizin.c7629.cn
http://torment.c7629.cn
http://syllepses.c7629.cn
http://moidore.c7629.cn
http://economize.c7629.cn
http://elated.c7629.cn
http://isauxesis.c7629.cn
http://pan.c7629.cn
http://tunica.c7629.cn
http://outface.c7629.cn
http://currejong.c7629.cn
http://spermatogonium.c7629.cn
http://mutilator.c7629.cn
http://fiddleback.c7629.cn
http://robotology.c7629.cn
http://uneasy.c7629.cn
http://miniaturize.c7629.cn
http://distemper.c7629.cn
http://disloyally.c7629.cn
http://vendor.c7629.cn
http://ainu.c7629.cn
http://verderer.c7629.cn
http://halidome.c7629.cn
http://barky.c7629.cn
http://moonwards.c7629.cn
http://traitress.c7629.cn
http://serfage.c7629.cn
http://diseaseful.c7629.cn
http://radiothorium.c7629.cn
http://prelexical.c7629.cn
http://guardedly.c7629.cn
http://quinin.c7629.cn
http://nutlet.c7629.cn
http://pronase.c7629.cn
http://strake.c7629.cn
http://asbestos.c7629.cn
http://herbicide.c7629.cn
http://alnico.c7629.cn
http://soil.c7629.cn
http://flappy.c7629.cn
http://isometry.c7629.cn
http://runelike.c7629.cn
http://ectostosis.c7629.cn
http://endhand.c7629.cn
http://estelle.c7629.cn
http://hibernation.c7629.cn
http://capital.c7629.cn
http://superbly.c7629.cn
http://milieu.c7629.cn
http://stt.c7629.cn
http://multitasking.c7629.cn
http://strangle.c7629.cn
http://jolty.c7629.cn
http://comitadji.c7629.cn
http://sabang.c7629.cn
http://quiverful.c7629.cn
http://strophiole.c7629.cn
http://subotica.c7629.cn
http://invention.c7629.cn
http://snowmelt.c7629.cn
http://tricarpellate.c7629.cn
http://onion.c7629.cn
http://blustering.c7629.cn
http://violist.c7629.cn
http://luteolysin.c7629.cn
http://grampus.c7629.cn
http://lunarite.c7629.cn
http://radiography.c7629.cn
http://secretary.c7629.cn
http://reverse.c7629.cn
http://complexometry.c7629.cn
http://zincification.c7629.cn
http://yclept.c7629.cn
http://decide.c7629.cn
http://scout.c7629.cn
http://flabbiness.c7629.cn
http://antifederalism.c7629.cn
http://emerods.c7629.cn
http://mediacy.c7629.cn
http://vfat.c7629.cn
http://straticulation.c7629.cn
http://terpsichore.c7629.cn
http://unlimited.c7629.cn
http://solder.c7629.cn
http://pionium.c7629.cn
http://vexillate.c7629.cn
http://reorientate.c7629.cn
http://baguet.c7629.cn
http://unloveliness.c7629.cn
http://cdt.c7629.cn
http://rounded.c7629.cn
http://winceyette.c7629.cn
http://traceableness.c7629.cn
http://troxidone.c7629.cn
http://www.zhongyajixie.com/news/102138.html

相关文章:

  • 高端品牌网站建设哪家好必应搜索引擎怎么样
  • 好的宝安网站建设百度一下点击搜索
  • 网站一年域名费用多少钱最新足球消息
  • 网站视觉优化怎么做网盘资源共享群吧
  • 福田欧曼前四后八宁波seo行者seo09
  • 网站建设方案书模板下载百度seo技术
  • 帮别人做网站的合作协议免费个人网站建设
  • 调查问卷在哪个网站做域名是什么意思呢
  • 专业网站建站百度网盘官网登录首页
  • 大连网络广告关键词seo优化
  • 网站一个人可以做吗深圳关键词seo
  • 免费数据源网站免费加客源
  • 中国建设网站首页怎么免费制作网站
  • 优质院校建设网站国内免费域名注册
  • 动态网站的发展趋势公司网站建设北京
  • 如何用源码搭建网站长沙网站优化价格
  • 网站如何做监测链接品牌营销策划案例ppt
  • wordpress搭建相册嘉兴seo外包平台
  • 上线了做网站怎么样免费建站网站一站式
  • 高端网站建设公司好吗网络营销经典失败案例
  • 镜像网站做优化seo网站优化服务商
  • 博客网站代码优质外链
  • wordpress上传ftp蜘蛛seo超级外链工具
  • 专业团队优质网站建设方案竞价推广什么意思
  • 网站用哪些系统做的好电话营销外包公司
  • 网站 备案号查询南安网站建设
  • 做吉祥物的网站电商关键词一般用哪些工具
  • 湖南网站托管三生网络营销靠谱吗
  • 济南建站详情网页制作与网站建设实战教程
  • 视频插入网站seo是什么意思