fix: hide tooltip on window leave event (#5309)

This commit is contained in:
nerix
2024-04-09 14:25:08 +02:00
committed by GitHub
parent 25a69fd10e
commit dd62707d53
4 changed files with 18 additions and 0 deletions
+14
View File
@@ -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()