mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
PopupWindow: Use same notifications as WebTab
This commit is contained in:
parent
635cc8e5eb
commit
abc7a2528b
|
@ -54,6 +54,17 @@ PopupWindow::PopupWindow(PopupWebView* view)
|
|||
m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
m_statusBarMessage = new PopupStatusBarMessage(this);
|
||||
|
||||
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);
|
||||
|
||||
m_menuBar = new QMenuBar(this);
|
||||
|
||||
QMenu* menuFile = new QMenu(tr("File"));
|
||||
|
@ -158,11 +169,11 @@ PopupWebView* PopupWindow::webView()
|
|||
|
||||
void PopupWindow::showNotification(QWidget* notif)
|
||||
{
|
||||
if (m_layout->count() > 4) {
|
||||
delete m_layout->itemAt(2)->widget();
|
||||
}
|
||||
|
||||
m_layout->insertWidget(2, notif);
|
||||
m_notificationWidget->setParent(nullptr);
|
||||
m_notificationWidget->setParent(m_view->overlayWidget());
|
||||
m_notificationWidget->setFixedWidth(m_view->width());
|
||||
m_notificationWidget->layout()->addWidget(notif);
|
||||
m_notificationWidget->show();
|
||||
notif->show();
|
||||
}
|
||||
|
||||
|
@ -218,6 +229,13 @@ void PopupWindow::closeEvent(QCloseEvent* event)
|
|||
event->accept();
|
||||
}
|
||||
|
||||
void PopupWindow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
m_notificationWidget->setFixedWidth(m_view->width());
|
||||
}
|
||||
|
||||
void PopupWindow::searchOnPage()
|
||||
{
|
||||
if (!m_search) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2010-2015 David Rosca <nowrep@gmail.com>
|
||||
* QupZilla - Qt web browser
|
||||
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -60,6 +60,7 @@ private slots:
|
|||
|
||||
private:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
PopupWebView* m_view;
|
||||
PopupLocationBar* m_locationBar;
|
||||
|
@ -74,6 +75,7 @@ private:
|
|||
QAction* m_actionReload;
|
||||
QAction* m_actionStop;
|
||||
QPointer<SearchToolBar> m_search;
|
||||
QWidget *m_notificationWidget;
|
||||
};
|
||||
|
||||
#endif // POPUPWINDOW_H
|
||||
|
|
|
@ -425,6 +425,7 @@ void WebTab::showNotification(QWidget* notif)
|
|||
{
|
||||
m_notificationWidget->setParent(nullptr);
|
||||
m_notificationWidget->setParent(this);
|
||||
m_notificationWidget->setFixedWidth(width());
|
||||
m_notificationWidget->layout()->addWidget(notif);
|
||||
m_notificationWidget->show();
|
||||
notif->show();
|
||||
|
|
Loading…
Reference in New Issue
Block a user