UI/Qt: Collapse hover-expanded vertical tabs after leaving window

When collapsed vertical tabs are expanded on hover, the collapse check
used QCursor::pos() against the vertical tabs rect. On some platforms,
after the cursor leaves the browser window entirely, that position can
remain at the last in-window coordinate, so the tabs stay expanded.
This commit is contained in:
Timothy Flynn 2026-06-04 15:18:54 -04:00 committed by Sam Atkins
parent 879fc69f89
commit 85c7620805

View file

@ -1570,11 +1570,14 @@ bool TabWidget::cursor_is_over_vertical_tabs() const
if (!m_vertical_tabs_content->isVisible())
return false;
if (m_vertical_tab_bar_column->underMouse() || m_tab_bar->underMouse() || m_new_tab_button->underMouse())
return true;
auto vertical_tabs_rect = QRect {
m_vertical_tabs_content->mapToGlobal(QPoint { 0, 0 }),
QSize { current_vertical_tabs_width(), m_vertical_tabs_content->height() }
};
return vertical_tabs_rect.contains(QCursor::pos());
return window()->underMouse() && vertical_tabs_rect.contains(QCursor::pos());
}
int TabWidget::vertical_tabs_layout_width() const