QWebEngineNotification 类

QWebEngineNotification 类封装 HTML5 Web 通知的数据。 更多...

头: #include <QWebEngineNotification>
CMake: find_package(Qt6 COMPONENTS WebEngineCore REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Since: Qt 5.13
实例化: 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 click () const
void close () const
void show () const

信号

void closed ()

详细描述

This class contains the information and API for HTML5 desktop and push notifications.

Web engine notifications are passed to the user through the custom handler provided with the QWebEngineProfile::setNotificationPresenter () 调用。

For more information about how to handle web notification, see the 通知范例 .

特性文档编制

[read-only] direction : const Qt::LayoutDirection

This property holds the text direction for the notification's title and body.

访问函数:

Qt::LayoutDirection direction () const

另请参阅 title () 和 message ().

[read-only] language : const QString

This property holds the primary language for the notification's title and body.

Its value is a valid BCP 47 language tag, or the empty string.

访问函数:

QString 语言 () const

另请参阅 title () 和 message ().

[read-only] message : const QString

This property holds the body of the notification message.

访问函数:

QString message () const

另请参阅 title ().

[read-only] origin : const QUrl

This property holds the URL of the page sending the notification.

访问函数:

QUrl origin () const

[read-only] tag : const QString

This property holds the tag of the notification message.

New notifications that have the same tag and origin URL as an existing one should replace or update the old notification with the same tag.

访问函数:

QString tag () const

另请参阅 matches ().

[read-only] title : const QString

This property holds the title of the notification.

访问函数:

QString title () const

另请参阅 message ().

成员函数文档编制

[slot] void QWebEngineNotification:: click () const

创建并分派 JavaScript click event on notification.

Should be called by the notification platform when the notification is activated by the user.

[slot] void QWebEngineNotification:: close () const

创建并分派 JavaScript 关闭事件 on notification.

Should be called by the notification platform when the notification is closed, either by the underlying platform or by the user.

[signal] void QWebEngineNotification:: closed ()

This signal is emitted when the web page calls close steps for the notification, and it no longer needs to be shown.

[slot] void QWebEngineNotification:: show () const

创建并分派 JavaScript show event on notification.

Should be called by the notification platform when the notification has been shown to user.

QImage QWebEngineNotification:: icon () const

Returns the icon to be shown with the notification.

If no icon is set by the sender, a null QImage 被返回。

bool QWebEngineNotification:: matches (const QWebEngineNotification * other ) const

返回 true if the two notifications belong to the same message chain. That is, if their tag () 和 origin () are the same. This means one is a replacement or an update of the other .

另请参阅 tag () 和 origin ().