diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 344c3ebac..ac42f53b9 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -148,6 +148,17 @@ WebTab::WebTab(BrowserWindow* window) layout->addWidget(m_splitter); setLayout(layout); + m_notificationWidget = new QWidget(this); + m_notificationWidget->setAutoFillBackground(true); + QPalette pal = m_notificationWidget->palette(); + pal.setColor(QPalette::Background, pal.window().color().darker(110)); + m_notificationWidget->setPalette(pal); + + QVBoxLayout *nlayout = new QVBoxLayout(m_notificationWidget); + nlayout->setSizeConstraint(QLayout::SetMinAndMaxSize); + nlayout->setContentsMargins(0, 0, 0, 0); + nlayout->setSpacing(1); + connect(m_webView, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*))); connect(m_webView, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); @@ -412,14 +423,11 @@ void WebTab::p_restoreTab(const WebTab::SavedTab &tab) void WebTab::showNotification(QWidget* notif) { - if (m_notification) { - delete m_notification; - } - - m_notification = notif; - m_notification->setParent(this); - m_notification->setFixedWidth(width());; - m_notification->show(); + m_notificationWidget->setParent(nullptr); + m_notificationWidget->setParent(this); + m_notificationWidget->layout()->addWidget(notif); + m_notificationWidget->show(); + notif->show(); } void WebTab::loadStarted() @@ -476,9 +484,7 @@ void WebTab::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); - if (m_notification) { - m_notification->setFixedWidth(width()); - } + m_notificationWidget->setFixedWidth(width()); } bool WebTab::isCurrentTab() const diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index 7b5466e31..a39f57592 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -21,7 +21,6 @@ #include #include #include -#include #include "qzcommon.h" @@ -125,7 +124,7 @@ private: LocationBar* m_locationBar; TabIcon* m_tabIcon; TabBar* m_tabBar; - QPointer m_notification; + QWidget *m_notificationWidget; SavedTab m_savedTab; bool m_isPinned;