How to check if tooltip is visible (digital clock)?
Rafał Miłecki
zajec5 at gmail.com
Sun Mar 30 19:37:14 CEST 2008
I have problem with avoiding unneeded updates of tray icon. I mainly
mean situation when user wants to have seconds displayed. It's obvious
that I use Plasma::DataEngine and connectSource(...) with
updateInterval 1 sec.
The problem is inside Clock::dataUpdated(...). Every time this method
is called I recreate Plasma::ToolTipData:
Plasma::ToolTipData tipData;
tipData.mainText = currentDate;
setToolTip(tipData);
I wish to avoid recreating tooltip and calling setToolTip when tooltip
is not visible. Problem is that I am not sure how should I check
tooltip status. My basic idea is to create internal boolean variable
like isToolTipDisplayed. I wonder how to change it's status. My ideas:
1) I can intercept event(..) and detect QEvent::ToolTip
(isToolTipDisplayed=true) and QEvent::HoverLeave
(isToolTipDisplayed=false).
2) I can use already prepared updateToolTip()
(isToolTipDisplayed=true) which allows me not filtering events in
event(). But I can't get know that tooltip disappeared so I don't know
when to change isToolTipDisplayed to false.
Is the first solution good enought to use for such a important part of
KDE as digital clock (nearly everyone use it!)? Should we implement
sth similar to updateToolTip(), let's say: toolTipRemoved()? Or maybe
someone has better idea?
--
Rafał Miłecki
More information about the Panel-devel
mailing list