Update containsMouse even if tooltips are disabled globally.
ToolTipAreas are often the critical path for mouse handling, since hover events are not filterable from below in the item hierarchy. When disabling tooltips also stops updating containsMouse code has no way to adapt, since there's no API to read the pref from within QML. This changes the implementation of the pref to only prevent tooltips from being shown, but still continue to handle hover events.
This commit is contained in:
parent
14ab84f5cc
commit
cfda5c4d70
@ -35,12 +35,16 @@ int ToolTip::s_dialogUsers = 0;
|
||||
|
||||
ToolTip::ToolTip(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_tooltipsEnabledGlobally(false),
|
||||
m_containsMouse(false),
|
||||
m_location(Plasma::Types::Floating),
|
||||
m_active(true),
|
||||
m_interactive(false),
|
||||
m_usingDialog(false)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
setFiltersChildMouseEvents(true);
|
||||
|
||||
m_showTimer = new QTimer(this);
|
||||
m_showTimer->setSingleShot(true);
|
||||
connect(m_showTimer, &QTimer::timeout, this, &ToolTip::showToolTip);
|
||||
@ -71,10 +75,7 @@ void ToolTip::settingsChanged()
|
||||
KConfigGroup cg(&config, "PlasmaToolTips");
|
||||
|
||||
m_interval = cg.readEntry("Delay", 700);
|
||||
bool enabled = m_interval > 0;
|
||||
|
||||
setAcceptHoverEvents(enabled);
|
||||
setFiltersChildMouseEvents(enabled);
|
||||
m_tooltipsEnabledGlobally = (m_interval > 0);
|
||||
}
|
||||
|
||||
QQuickItem *ToolTip::mainItem() const
|
||||
@ -306,7 +307,11 @@ void ToolTip::setContainsMouse(bool contains)
|
||||
void ToolTip::hoverEnterEvent(QHoverEvent *event)
|
||||
{
|
||||
setContainsMouse(true);
|
||||
//m_showTimer->stop();
|
||||
|
||||
if (!m_tooltipsEnabledGlobally) {
|
||||
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
|
||||
|
@ -174,6 +174,7 @@ private Q_SLOTS:
|
||||
void settingsChanged();
|
||||
|
||||
private:
|
||||
bool m_tooltipsEnabledGlobally;
|
||||
bool m_containsMouse;
|
||||
Plasma::Types::Location m_location;
|
||||
QWeakPointer<QQuickItem> m_mainItem;
|
||||
|
Loading…
Reference in New Issue
Block a user