summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp7
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_popup.cpp6
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_popup.h1
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.cpp6
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.h1
5 files changed, 19 insertions, 2 deletions
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index a2934905..3f3fdd7c 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -228,8 +228,11 @@ bool QWebEngineView::event(QEvent *ev)
if (ev->type() == QEvent::ContextMenu) {
ev->accept();
return true;
- } else if (ev->type() == QEvent::MetaCall)
- // Meta calls are not safe to forward to the page, as they could be widget specific (e.g. QWidgetPrivate::_q_showIfNotHidden)
+
+ // Meta calls are not safe to forward to the page, as they could be widget specific (e.g. QWidgetPrivate::_q_showIfNotHidden)
+ // ToolTip events need to be processed at the widget level for the tooltip to show.
+ } else if (ev->type() == QEvent::MetaCall
+ || ev->type() == QEvent::ToolTip)
return QWidget::event(ev);
if (d->page && d->page->event(ev))
return true;
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.cpp
index 7900ed9b..eae3b8a6 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.cpp
@@ -62,6 +62,7 @@ RenderWidgetHostViewQtDelegatePopup::RenderWidgetHostViewQtDelegatePopup(RenderW
// loses focus, WebKit will cause its associated popups (including this one)
// to be destroyed.
setAttribute(Qt::WA_ShowWithoutActivating);
+ setAttribute(Qt::WA_AlwaysShowToolTips);
setFocusPolicy(Qt::NoFocus);
setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
}
@@ -137,6 +138,11 @@ void RenderWidgetHostViewQtDelegatePopup::move(const QPoint &pos)
QWidget::move(mapped);
}
+void RenderWidgetHostViewQtDelegatePopup::setTooltip(const QString &tooltip)
+{
+ setToolTip(tooltip);
+}
+
void RenderWidgetHostViewQtDelegatePopup::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.h
index 330afc25..5f3e6595 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.h
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_popup.h
@@ -74,6 +74,7 @@ public:
virtual void move(const QPoint &) Q_DECL_OVERRIDE;
virtual void inputMethodStateChanged(bool) Q_DECL_OVERRIDE {}
virtual bool supportsHardwareAcceleration() const Q_DECL_OVERRIDE { return false; }
+ virtual void setTooltip(const QString &tooltip) Q_DECL_OVERRIDE;
protected:
void paintEvent(QPaintEvent * event);
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.cpp
index d6e99f4e..e8a3e7d4 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.cpp
@@ -139,6 +139,12 @@ bool RenderWidgetHostViewQtDelegateWebPage::supportsHardwareAcceleration() const
return false;
}
+void RenderWidgetHostViewQtDelegateWebPage::setTooltip(const QString &tooltip)
+{
+ if (m_page && m_page->view())
+ m_page->view()->setToolTip(tooltip);
+}
+
void RenderWidgetHostViewQtDelegateWebPage::paint(QPainter *painter, const QRectF &boundingRect)
{
m_client->fetchBackingStore();
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.h
index 52988aef..80da9d72 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.h
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_webpage.h
@@ -75,6 +75,7 @@ public:
virtual void move(const QPoint&) Q_DECL_OVERRIDE {}
virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
virtual bool supportsHardwareAcceleration() const Q_DECL_OVERRIDE;
+ virtual void setTooltip(const QString &tooltip) Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QRectF &boundingRect);
void notifyResize();