forked from qt-creator/qt-creator
Tooltip: Hide when Escape is pressed
Change-Id: Ib516cbbd9b51ddac3dac48668e3341830233af4b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
ac2012a73a
commit
50e3085f22
@@ -305,9 +305,11 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::KeyPress:
|
||||
case QEvent::KeyRelease:
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
case QEvent::KeyRelease: {
|
||||
int key = static_cast<QKeyEvent *>(event)->key();
|
||||
if (key == Qt::Key_Escape)
|
||||
hideTipImmediately();
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
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();
|
||||
|
Reference in New Issue
Block a user