Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10644 from shuffle2/hide-balloon
Qt: hide balloon tooltip when parent gets hidden
  • Loading branch information
JosJuice committed May 8, 2022
2 parents 299d5c0 + 1e033a4 commit e19b995
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 e19b995

Please sign in to comment.