Skip to content

fix: hide tooltip on window leave event #5309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unversioned

- Bugfix: Fixed split tooltip getting stuck in some cases. (#5309)

## 2.5.0-beta.1

- Major: Twitch follower emotes can now be correctly tabbed in other channels when you are subscribed to the channel the emote is from. (#4922)
Expand Down
1 change: 1 addition & 0 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ void BaseWindow::changeEvent(QEvent *)

void BaseWindow::leaveEvent(QEvent *)
{
this->leaving.invoke();
}

void BaseWindow::moveTo(QPoint point, widgets::BoundsChecking mode)
Expand Down
1 change: 1 addition & 0 deletions src/widgets/BaseWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class BaseWindow : public BaseWidget
void setTopMost(bool topMost);

pajlada::Signals::NoArgSignal closing;
pajlada::Signals::NoArgSignal leaving;

static bool supportsCustomWindowFrame();

Expand Down
14 changes: 14 additions & 0 deletions src/widgets/splits/SplitHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,20 @@ SplitHeader::SplitHeader(Split *split)
getSettings()->headerStreamTitle.connect(_, this->managedConnections_);
getSettings()->headerGame.connect(_, this->managedConnections_);
getSettings()->headerUptime.connect(_, this->managedConnections_);

auto *window = dynamic_cast<BaseWindow *>(this->window());
if (window)
{
// Hack: In some cases Qt doesn't send the leaveEvent the "actual" last mouse receiver.
// This can happen when quickly moving the mouse out of the window and right clicking.
// To prevent the tooltip from getting stuck, we use the window's leaveEvent.
this->managedConnections_.managedConnect(window->leaving, [this] {
if (this->tooltipWidget_->isVisible())
{
this->tooltipWidget_->hide();
}
});
}
}

void SplitHeader::initializeLayout()
Expand Down
Loading