Unify when tooltips are shown and kept alive.

A new tooltip would only be shown if it had content to show.

However in the old code if the tooltip was already visible we would keep
the tooltip alive and sync with empty contents regardless of whether we
had anything to show.

This seems to clear up the system tray where we have nested tooltip
areas for the tray applet and the icon itself and things would flicker

Change-Id: I7d9ded9edb70672c572e008c8d6f1ffe2d76b773
Changelog: Avoid showing an empty tooltip
This commit is contained in:
David Edmundson 2015-02-10 15:25:38 +01:00
parent 8fb6f677dd
commit b71d33f2be

View File

@ -304,6 +304,9 @@ void ToolTip::hoverEnterEvent(QHoverEvent *event)
return;
}
if (!m_mainItem && mainText().isEmpty() && subText().isEmpty()) {
return;
}
if (tooltipDialogInstance()->isVisible()) {
// We signal the tooltipmanager that we're "potentially interested,
// and ask to keep it open for a bit, so other items get the chance
@ -312,7 +315,7 @@ void ToolTip::hoverEnterEvent(QHoverEvent *event)
tooltipDialogInstance()->keepalive();
//FIXME: showToolTip needs to be renamed in sync or something like that
showToolTip();
} else if (m_mainItem || !mainText().isEmpty() || !subText().isEmpty()) {
} else {
m_showTimer->start(m_interval);
}
}