QWebEngineNotification Class
QWebEngineNotification 类封装了 HTML5 网络通知的数据。更多
头文件: | #include <QWebEngineNotification> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore) |
qmake: | QT += webenginecore |
在 QML 中: | WebEngineNotification |
继承: | QObject |
属性
公共功能
Qt::LayoutDirection | direction() const |
QImage | icon() const |
QString | language() const |
bool | matches(const QWebEngineNotification *other) const |
QString | message() const |
QUrl | origin() const |
QString | tag() const |
QString | title() const |
公共插槽
信号
void | closed() |
详细说明
该类包含 HTML5 桌面和推送通知的信息和 API。
网络引擎通知通过QWebEngineProfile::setNotificationPresenter() 调用提供的自定义处理程序传递给用户。
有关如何处理网络通知的更多信息,请参阅通知示例。
属性文档
[read-only]
direction : const Qt::LayoutDirection
该属性用于保存通知标题和正文的文本方向。
访问功能:
Qt::LayoutDirection | direction() const |
[read-only]
language : const QString
该属性用于保存通知标题和正文的主要语言。
其值为有效的 BCP 47 语言标记或空字符串。
访问功能:
QString | language() const |
[read-only]
message : const QString
该属性包含通知信息的正文。
访问功能:
QString | message() const |
另请参阅 title().
[read-only]
origin : const QUrl
此属性包含发送通知的页面的 URL。
访问功能:
QUrl | origin() const |
[read-only]
tag : const QString
此属性包含通知信息的标记。
如果新通知与现有通知具有相同的标签和来源 URL,则应使用相同的标签替换或更新旧通知。
访问功能:
QString | tag() const |
另请参阅 matches().
[read-only]
title : const QString
该属性包含通知的标题。
访问功能:
QString | title() const |
另请参阅 message().
成员函数文档
[slot]
void QWebEngineNotification::click() const
创建并调度通知的 JavaScript点击事件。
当用户激活通知时,通知平台应调用该事件。
[slot]
void QWebEngineNotification::close() const
在通知上创建并发送 JavaScript关闭事件。
当底层平台或用户关闭通知时,通知平台应调用该事件。
[signal]
void QWebEngineNotification::closed()
当网页调用通知的关闭步骤,不再需要显示通知时,就会发出该信号。
QImage QWebEngineNotification::icon() const
返回与通知一起显示的图标。
如果发件人没有设置图标,则返回空QImage 。
bool QWebEngineNotification::matches(const QWebEngineNotification *other) const
如果两个通知属于同一消息链,则返回true
。也就是说,如果它们的tag() 和origin() 相同。这意味着其中一个是other 的替换或更新。
[slot]
void QWebEngineNotification::show() const
为通知创建并发送 JavaScript显示事件。
当通知显示给用户时,通知平台应调用该事件。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.