Utils: Hide tooltip if application becomes inactive

Switching to another application with "Alt+Tab" was working fine here -
the tooltip closed as expected. But switching by clicking on another
application window lead to a left over tooltip.

Tested with openbox 3.6 window manager.

Task-number: QTCREATORBUG-13397
Change-Id: Id92f6df3b63256a962591df2912a0819fc777073
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2016-02-04 12:59:16 +01:00
parent 95d8ed71db
commit c47e52c97b

View File

@@ -48,6 +48,13 @@ ToolTip::ToolTip() : m_tip(0), m_widget(0)
{ {
connect(&m_showTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately); connect(&m_showTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately);
connect(&m_hideDelayTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately); connect(&m_hideDelayTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately);
connect(static_cast<QGuiApplication *>(QGuiApplication::instance()),
&QGuiApplication::applicationStateChanged,
[this](Qt::ApplicationState state) {
if (state != Qt::ApplicationActive)
hideTipImmediately();
}
);
} }
ToolTip::~ToolTip() ToolTip::~ToolTip()