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

dw怎样建设网站ajax实现wordpress导航栏

dw怎样建设网站,ajax实现wordpress导航栏,茶叶外贸网站建设,wordpress自动插件文章目录一.QMessageBox介绍枚举属性函数二.QMessageBox的用法1.导入QMessage库2.弹窗提示3.提供选项的弹窗提示4.作为提示,报警,报错提示窗口一.QMessageBox介绍 文本消息显示框(message box)向用户发出情况警报信息并进一步解释警报或向用户提问&…

文章目录

  • 一.QMessageBox介绍
    • 枚举
    • 属性
    • 函数
  • 二.QMessageBox的用法
    • 1.导入QMessage库
    • 2.弹窗提示
    • 3.提供选项的弹窗提示
    • 4.作为提示,报警,报错提示窗口

一.QMessageBox介绍

文本消息显示框(message box)向用户发出情况警报信息并进一步解释警报或向用户提问,以及可选的详细文本以在用户请求时提供更多数据。

枚举

枚举枚举值
enumButtonRole { InvalidRole, AcceptRole, RejectRole, DestructiveRole, ActionRole, …, ResetRole }
enumIcon { NoIcon, Question, Information, Warning, Critical }
enumStandardButton { Ok, Open, Save, Cancel, Close, …, ButtonMask }
flagsStandardButtons

属性

属性名称类型
detailedTextQString
standardButtonsStandardButtons
iconIcon
iconPixmapQPixmap
informativeTextQString
textQString
textFormatQt::TextFormat
textInteractionFlagsQt::TextInteractionFlags

函数

返回值函数原型说明
QMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::DialogQt::MSWindowsFixedSizeDialogHint)
QMessageBox(QWidget *parent = nullptr)构造函数
virtual~QMessageBox()析构函数
voidaddButton(QAbstractButton *button, QMessageBox::ButtonRole role)添加按钮到消息框中
QPushButton *addButton(const QString &text, QMessageBox::ButtonRole role)添加按钮到消息框中
QPushButton *addButton(QMessageBox::StandardButton button)添加按钮到消息框中
QAbstractButton *button(QMessageBox::StandardButton which) const返回与标准按钮对应的指针,如果此消息框中不存在标准按钮,则返回nullptr
QMessageBox::ButtonRolebuttonRole(QAbstractButton *button) const返回指定按钮的按钮角色。如果按钮为nullptr或尚未添加到消息框,则此函数返回InvalidRole。
QList<QAbstractButton *>buttons() const返回已添加到消息框中的所有按钮的列表。
QCheckBox *checkBox() const返回对话框上显示的复选框。如果未设置任何复选框,则为nullptr。
QAbstractButton *clickedButton() const返回用户单击的按钮,如果用户按Esc键且未设置转义按钮,则返回nullptr。
QPushButton *defaultButton() const返回应该是消息框默认按钮的按钮。如果未设置默认按钮,则返回nullptr。
QStringdetailedText() const保存要显示在详细信息区域中的文本。
QAbstractButton *escapeButton() const返回按下转义时激活的按钮。
QMessageBox::Iconicon() const保存消息框的图标
QPixmapiconPixmap() const保存当前图标
QStringinformativeText() const包含为消息提供更完整描述的信息性文本
voidopen(QObject *receiver, const char *member)打开对话框并将其 finished()或 buttonClicked()信号连接到接收器和成员指定的插槽。如果slot-in成员的第一个参数有一个指针,则连接到 buttonClicked(),否则连接到finished()。
voidremoveButton(QAbstractButton *button)从按钮框中删除按钮而不删除它。
voidsetCheckBox(QCheckBox *cb)设置消息对话框上的复选框cb。消息框获取复选框的所有权。参数cb可以是nullptr,以从消息框中删除现有复选框。
voidsetDefaultButton(QPushButton *button)将消息框的默认按钮设置为按钮。
voidsetDefaultButton(QMessageBox::StandardButton button)将消息框的默认按钮设置为按钮。
voidsetDetailedText(const QString &text)保存要显示在详细信息区域中的文本。
voidsetEscapeButton(QAbstractButton *button)将按下Escape键时激活的按钮设置为按钮。
voidsetEscapeButton(QMessageBox::StandardButton button)将按下Escape键时激活的按钮设置为按钮。
voidsetIcon(QMessageBox::Icon)保存消息框的图标
voidsetIconPixmap(const QPixmap &pixmap)保存消息框的图标
voidsetInformativeText(const QString &text)保存要显示的消息框文本
voidsetStandardButtons(QMessageBox::StandardButtons buttons)根据文本格式设置(QMessageBox::textFormat),文本将被解释为纯文本或富文本。默认设置为 Qt::AutoText,,即消息框将尝试自动检测文本的格式。
voidsetText(const QString &text)保存要显示的消息框文本
voidsetTextFormat(Qt::TextFormat format)保存消息框显示的文本格式
voidsetTextInteractionFlags(Qt::TextInteractionFlags flags)
voidsetWindowModality(Qt::WindowModality windowModality)
voidsetWindowTitle(const QString &title)
QMessageBox::StandardButtonstandardButton(QAbstractButton *button) const返回与给定按钮对应的标准按钮枚举值,如果给定按钮不是标准按钮,则返回NoButton。
QMessageBox::StandardButtonsstandardButtons() const返回与给定按钮对应的标准按钮枚举值,如果给定按钮不是标准按钮,则返回NoButton。
QStringtext() const保存要显示的消息框文本
Qt::TextFormattextFormat() const保存消息框显示的文本格式
Qt::TextInteractionFlagstextInteractionFlags() const

二.QMessageBox的用法

1.导入QMessage库

#include <QMessageBox>

2.弹窗提示

构造QMessageBox的实例,设置所需显示的消息,然后调用exec()来显示消息。用户必须单击“确定”按钮以关闭消息框。GUI的其余部分将被阻止,直到消息框被关闭。

QMessageBox msgBox;
msgBox.setText(u8"你好~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
msgBox.exec();

在这里插入图片描述

3.提供选项的弹窗提示

一个比仅仅提醒用户事件更好的方法是询问用户该怎么做。将问题存储在信息性文本属性中,并将标准按钮属性设置为所需的按钮集作为用户响应集。通过使用位或运算符组合StandardButtons中的值来指定按钮。按钮的显示顺序取决于平台。例如,在Windows上,“保存”显示在“取消”的左侧,而在Mac OS上,顺序相反。要向用户提供更多信息以帮助他回答问题,通过setDetailedText设置详细文本属性。如果设置了详细文本属性,则显示详细信息按钮。exec()槽返回单击的按钮的StandardButtons值。

QMessageBox msgBox;
msgBox.setText(u8"该文档已被修改.");
msgBox.setDetailedText(u8"这里是详细的提示信息");
msgBox.setInformativeText(u8"是否要保存你的修改?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Save);
int ret = msgBox.exec();switch (ret) {case QMessageBox::Save:qDebug() << "save";break;case QMessageBox::Discard:qDebug() << "Discard";break;case QMessageBox::Cancel:qDebug() << "Cancel";break;default:qDebug() << "default";break;
}

在这里插入图片描述

4.作为提示,报警,报错提示窗口

int ret = QMessageBox::information(this, tr(u8"信息提示"),tr(u8"该文档已被修改.\n"u8"是否要保存你的修改?"),QMessageBox::Ok | QMessageBox::Cancel | QMessageBox::Help);

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
对于窗口的类型,有以下几种可以选择:

内容说明
QMessageBox::NoIcon0the message box does not have any icon.
QMessageBox::Question4an icon indicating that the message is asking a question.
QMessageBox::Information1an icon indicating that the message is nothing out of the ordinary.
QMessageBox::Warning2an icon indicating that the message is a warning, but can be dealt with.
QMessageBox::Critical3an icon indicating that the message represents a critical problem.

对于窗口中的按钮,有以下几种可以选择:

内容说明
QMessageBox::Ok0x00000400An “OK” button defined with the AcceptRole.
QMessageBox::Open0x00002000An “Open” button defined with the AcceptRole.
QMessageBox::Save0x00000800A “Save” button defined with the AcceptRole.
QMessageBox::Cancel0x00400000A “Cancel” button defined with the RejectRole.
QMessageBox::Close0x00200000A “Close” button defined with the RejectRole.
QMessageBox::Discard0x00800000A “Discard” or “Don’t Save” button, depending on the platform, defined with the DestructiveRole.
QMessageBox::Apply0x02000000An “Apply” button defined with the ApplyRole.
QMessageBox::Reset0x04000000A “Reset” button defined with the ResetRole.
QMessageBox::RestoreDefaults0x08000000A “Restore Defaults” button defined with the ResetRole.
QMessageBox::Help0x01000000A “Help” button defined with the HelpRole.
QMessageBox::SaveAll0x00001000A “Save All” button defined with the AcceptRole.
QMessageBox::Yes0x00004000A “Yes” button defined with the YesRole.
QMessageBox::YesToAll0x00008000A “Yes to All” button defined with the YesRole.
QMessageBox::No0x00010000A “No” button defined with the NoRole.
QMessageBox::NoToAll0x00020000A “No to All” button defined with the NoRole.
QMessageBox::Abort0x00040000An “Abort” button defined with the RejectRole.
QMessageBox::Retry0x00080000A “Retry” button defined with the AcceptRole.
QMessageBox::Ignore0x00100000An “Ignore” button defined with the AcceptRole.
QMessageBox::NoButton0x00000000An invalid button.
http://www.sczhlp.com/news/151386/

相关文章:

  • 网站建设在淘宝怎么分类电子商城网站开发公司
  • 深圳网站制作公司方案安徽鲲鹏建设集团有限公司网站
  • 响应式网站开发设计公司核名查询官网
  • 学习网站开发教程东莞常平牙科
  • 网站怎么申请支付宝接口iis与wordpress
  • 江苏seo网站排名优化广东建立网站
  • 设计素材网站图案免费重庆微信网站建设报价表
  • jsp网站开发目的及意义电子商城网站建设流程
  • 9月30日
  • 读博期间的工作节奏与身心状态管理经验总结
  • 崇州市建设局网站discuz怎么做h5网站
  • 现在能用的网站站内优化seo
  • 简单的手机网站模板免费下载phpmysql网站开发实例
  • 网站网站是否需要备案北京国家建设部网站
  • 2019做什么类型网站深圳设计网站培训
  • 2016做网站还赚钱吗怎么描述网站
  • 扁平化蓝色网站模板上海嘉定建设局网站
  • 网站域名的作用网站建设目标是
  • 一个虚拟主机可以做几个网站吗用什么软件制作图片
  • 【Rust GUI开发入门】编写一个本地音乐播放器(7. 制作歌词显示面板) - Jordan
  • 邯郸哪里做网站优化比较漂亮的营销型网站
  • 网站建设课题简介一个域名一个ip做多个网站
  • 如何对网站的图片做cdn广西seo网站
  • 做网站为什么赚钱吗济南 网站 建设
  • 网站前台设计过程网站设计部
  • 三亚制作网站中企动力邮箱登陆入口
  • 灯塔网站建设服务器网站备案
  • 网站开发工程师 招聘新思维网站
  • 2025 火烧板源头厂家最新推荐榜:自有矿山保障品质,五莲花 / 芝麻白 / 防滑芝麻黑产品品牌权威甄选 —— 园林景观 / 外墙干挂 / 广场铺装采购指南
  • 国内做的好看的网站设计广州网站站建设培训