use the global option for tooltips

still has to watch for config file changes
This commit is contained in:
Marco Martin 2014-04-11 17:18:28 +02:00
parent 724909d25b
commit d342c2e186
2 changed files with 10 additions and 3 deletions

View File

@ -46,8 +46,14 @@ ToolTip::ToolTip(QQuickItem *parent)
showToolTip(); showToolTip();
}); });
setAcceptHoverEvents(true); KConfig config("plasmarc");
setFiltersChildMouseEvents(true); KConfigGroup cg(&config, "PlasmaToolTips");
m_interval = cg.readEntry("Delay", 700);
bool enabled = m_interval > 0;
setAcceptHoverEvents(enabled);
setFiltersChildMouseEvents(enabled);
} }
ToolTip::~ToolTip() ToolTip::~ToolTip()
@ -297,7 +303,7 @@ void ToolTip::hoverEnterEvent(QHoverEvent *event)
showToolTip(); showToolTip();
} else if (m_mainItem || } else if (m_mainItem ||
(!mainText().isEmpty() && !subText().isEmpty())) { (!mainText().isEmpty() && !subText().isEmpty())) {
m_showTimer->start(500); m_showTimer->start(m_interval);
} }
} }

View File

@ -181,6 +181,7 @@ private:
QVariant m_icon; QVariant m_icon;
bool m_active; bool m_active;
bool m_interactive; bool m_interactive;
int m_interval;
//ToolTipDialog is not a Q_GLOBAL_STATIC because QQuickwindows as global static //ToolTipDialog is not a Q_GLOBAL_STATIC because QQuickwindows as global static
//are deleted too later after some stuff in the qml runtime has already been deleted, //are deleted too later after some stuff in the qml runtime has already been deleted,