Commit 50e3085f authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Tooltip: Hide when Escape is pressed

Change-Id: Ib516cbbd9b51ddac3dac48668e3341830233af4b
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent ac2012a7
......@@ -305,9 +305,11 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
switch (event->type()) {
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::KeyRelease: {
int key = static_cast<QKeyEvent *>(event)->key();
if (key == Qt::Key_Escape)
hideTipImmediately();
if (HostOsInfo::isMacHost()) {
int key = static_cast<QKeyEvent *>(event)->key();
Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(event)->modifiers();
if (!(mody & Qt::KeyboardModifierMask)
&& key != Qt::Key_Shift && key != Qt::Key_Control
......@@ -315,6 +317,7 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
hideTipWithDelay();
}
break;
}
case QEvent::Leave:
if (o == m_tip && !m_tip->isAncestorOf(QApplication::focusWidget()))
hideTipWithDelay();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment