UI: Inform WebContent when the mouse leaves the WebView widget

Previously, when the mouse left the WebView, the currently hovered node
would remain hovered (including the scroll bar). This felt a bit awkward
and is not how other browsers behave.
This commit is contained in:
Timothy Flynn 2025-07-27 09:55:26 -04:00 committed by Alexander Kalenik
commit bc4112bf18
Notes: github-actions[bot] 2025-07-28 03:39:09 +00:00
3 changed files with 20 additions and 1 deletions

View file

@ -402,6 +402,16 @@ QVariant WebContentView::inputMethodQuery(Qt::InputMethodQuery) const
return QVariant();
}
void WebContentView::leaveEvent(QEvent* event)
{
static constexpr QPointF point { NumericLimits<qreal>::max(), NumericLimits<qreal>::max() };
QMouseEvent mouse_event { QEvent::Type::MouseMove, point, point, Qt::MouseButton::NoButton, Qt::MouseButton::NoButton, Qt::KeyboardModifier::NoModifier };
enqueue_native_event(Web::MouseEvent::Type::MouseMove, mouse_event);
QWidget::leaveEvent(event);
}
void WebContentView::mouseMoveEvent(QMouseEvent* event)
{
if (!m_tooltip_override) {