Skip to content

Commit

Permalink
Qt: hide balloon tooltip when parent gets hidden
Browse files Browse the repository at this point in the history
fixes balloon remaining onscreen when parent gets
hidden via escape key for example.
  • Loading branch information
shuffle2 committed May 8, 2022
1 parent 5f04ad5 commit 1e033a4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Source/Core/DolphinQt/Config/ToolTipControls/ToolTipWidget.h
Expand Up @@ -33,15 +33,8 @@ class ToolTipWidget : public Derived
m_timer_id = this->startTimer(TOOLTIP_DELAY);
}

void leaveEvent(QEvent* event) override
{
if (m_timer_id)
{
this->killTimer(*m_timer_id);
m_timer_id.reset();
}
BalloonTip::HideBalloon();
}
void leaveEvent(QEvent* event) override { KillAndHide(); }
void hideEvent(QHideEvent* event) override { KillAndHide(); }

void timerEvent(QTimerEvent* event) override
{
Expand All @@ -54,6 +47,16 @@ class ToolTipWidget : public Derived

virtual QPoint GetToolTipPosition() const = 0;

void KillAndHide()
{
if (m_timer_id)
{
this->killTimer(*m_timer_id);
m_timer_id.reset();
}
BalloonTip::HideBalloon();
}

std::optional<int> m_timer_id;
QString m_title;
QString m_description;
Expand Down

0 comments on commit 1e033a4

Please sign in to comment.