diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-09-24 12:03:59 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-09-25 14:59:50 +0200 |
commit | 77517b562777b8975d7b2345cc6790e6925ed136 (patch) | |
tree | 3bd9da3e6842af2d0b9c04b46693c66ab437fd2e /examples/webenginewidgets/notifications/notificationpopup.h | |
parent | 16192598a84eaf9ac9a50b7cca6ac5e4c21bb5e8 (diff) | |
parent | 52345f558f55e04ea68a8fa30d9862ca69131a18 (diff) |
Merge "Merge remote-tracking branch 'origin/5.13' into 5.14"
Diffstat (limited to 'examples/webenginewidgets/notifications/notificationpopup.h')
-rw-r--r-- | examples/webenginewidgets/notifications/notificationpopup.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/examples/webenginewidgets/notifications/notificationpopup.h b/examples/webenginewidgets/notifications/notificationpopup.h index fcbb003b9..d211c7996 100644 --- a/examples/webenginewidgets/notifications/notificationpopup.h +++ b/examples/webenginewidgets/notifications/notificationpopup.h @@ -61,14 +61,16 @@ #include <memory> -class NotificationPopup : public QWidget { +class NotificationPopup : public QWidget +{ Q_OBJECT QLabel m_icon, m_title, m_message; std::unique_ptr<QWebEngineNotification> notification; public: - NotificationPopup(QWidget *parent) : QWidget(parent) { + NotificationPopup(QWidget *parent) : QWidget(parent) + { setWindowFlags(Qt::ToolTip); auto rootLayout = new QHBoxLayout(this); @@ -91,7 +93,8 @@ public: adjustSize(); } - void present(std::unique_ptr<QWebEngineNotification> &newNotification) { + void present(std::unique_ptr<QWebEngineNotification> &newNotification) + { if (notification) { notification->close(); notification.reset(); @@ -114,14 +117,16 @@ public: } protected slots: - void onClosed() { + void onClosed() + { hide(); notification->close(); notification.reset(); } protected: - void mouseReleaseEvent(QMouseEvent *event) override { + void mouseReleaseEvent(QMouseEvent *event) override + { QWidget::mouseReleaseEvent(event); if (notification && event->button() == Qt::LeftButton) { notification->click(); |