Commit 1f00898a authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Presentation: Don't hide toolbar if we're not really leaving the window

BUGS: 444427
parent 975bf990
Pipeline #101121 skipped
......@@ -906,11 +906,43 @@ void PresentationWidget::resizeEvent(QResizeEvent *re)
// END Content area
}
void PresentationWidget::enterEvent(QEvent *e)
{
if (!m_topBar->isHidden()) {
QEnterEvent *ee = static_cast<QEnterEvent *>(e);
// This can happen when we exited the widget via a "tooltip" and the tooltip disappears
if (ee->y() > (m_topBar->height() + 1)) {
showTopBar(false);
}
}
QWidget::enterEvent(e);
}
void PresentationWidget::leaveEvent(QEvent *e)
{
Q_UNUSED(e)
if (!m_topBar->isHidden()) {
if (QToolTip::isVisible()) {
// make sure we're not hovering over the tooltip
// because the world is sad, this works differently on Wayland and X11
// on X11 the widget under the cursor is the tooltip window
// on wayland it's the button generating the tooltip (why? no idea)
const QWidget *widgetUnderCursor = qApp->widgetAt(QCursor::pos());
if (widgetUnderCursor) {
const QWidget *widgetUnderCursorWindow = widgetUnderCursor->window();
if (widgetUnderCursorWindow == this) {
qDebug() << "Wayland";
return;
} else {
const QWidget *widgetUnderCursorParentWindow = widgetUnderCursorWindow->parentWidget() ? widgetUnderCursorWindow->parentWidget()->window() : nullptr;
if (widgetUnderCursorParentWindow == this) {
qDebug() << "X11";
return;
}
}
}
}
showTopBar(false);
}
}
......
......@@ -75,6 +75,7 @@ protected:
void mouseMoveEvent(QMouseEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
void enterEvent(QEvent *e) override;
void leaveEvent(QEvent *e) override;
bool gestureEvent(QGestureEvent *e);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment