diff --git a/src/lib/tools/html5permissions/html5permissionsnotification.cpp b/src/lib/tools/html5permissions/html5permissionsnotification.cpp index e011ec5fe..a21fdc6e0 100644 --- a/src/lib/tools/html5permissions/html5permissionsnotification.cpp +++ b/src/lib/tools/html5permissions/html5permissionsnotification.cpp @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2013-2015 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2013-2017 David Rosca * * 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 @@ -87,15 +87,7 @@ void HTML5PermissionsNotification::grantPermissions() return; } - QTimer::singleShot(0, this, [this]() { - // We need to have cursor inside view to correctly grab mouse - if (m_feature == QWebEnginePage::MouseLock) { - QWidget *view = m_page->view(); - QCursor::setPos(view->mapToGlobal(view->rect().center())); - } - - m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser); - }); + m_page->setFeaturePermission(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser); if (ui->remember->isChecked()) { mApp->html5PermissionsManager()->rememberPermissions(m_origin, m_feature, QWebEnginePage::PermissionGrantedByUser); diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 211b4ba56..7608b5f2f 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2016 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2010-2017 David Rosca * * 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 @@ -385,14 +385,14 @@ void WebTab::p_restoreTab(const WebTab::SavedTab &tab) void WebTab::showNotification(QWidget* notif) { - const int notifPos = 0; - - if (m_layout->count() > notifPos + 1) { - delete m_layout->itemAt(notifPos)->widget(); + if (m_notification) { + delete m_notification; } - m_layout->insertWidget(notifPos, notif); - notif->show(); + m_notification = notif; + m_notification->setParent(this); + m_notification->setFixedWidth(width());; + m_notification->show(); } void WebTab::loadStarted() @@ -445,6 +445,15 @@ void WebTab::showEvent(QShowEvent* event) } } +void WebTab::resizeEvent(QResizeEvent *event) +{ + QWidget::resizeEvent(event); + + if (m_notification) { + m_notification->setFixedWidth(width()); + } +} + bool WebTab::isCurrentTab() const { return m_tabBar && tabIndex() == m_tabBar->currentIndex(); diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index ccc0c7548..bfaca9fc1 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2010-2017 David Rosca * * 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 @@ -21,6 +21,7 @@ #include #include #include +#include #include "qzcommon.h" @@ -111,6 +112,7 @@ private slots: private: void showEvent(QShowEvent* event); + void resizeEvent(QResizeEvent *event) override; BrowserWindow* m_window; QVBoxLayout* m_layout; @@ -121,6 +123,7 @@ private: LocationBar* m_locationBar; TabIcon* m_tabIcon; TabBar* m_tabBar; + QPointer m_notification; SavedTab m_savedTab; bool m_isPinned;