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()) {
|
switch (event->type()) {
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
case QEvent::KeyRelease:
|
case QEvent::KeyRelease: {
|
||||||
if (HostOsInfo::isMacHost()) {
|
|
||||||
int key = static_cast<QKeyEvent *>(event)->key();
|
int key = static_cast<QKeyEvent *>(event)->key();
|
||||||
|
if (key == Qt::Key_Escape)
|
||||||
|
hideTipImmediately();
|
||||||
|
if (HostOsInfo::isMacHost()) {
|
||||||
Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(event)->modifiers();
|
Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(event)->modifiers();
|
||||||
if (!(mody & Qt::KeyboardModifierMask)
|
if (!(mody & Qt::KeyboardModifierMask)
|
||||||
&& key != Qt::Key_Shift && key != Qt::Key_Control
|
&& key != Qt::Key_Shift && key != Qt::Key_Control
|
||||||
@@ -315,6 +317,7 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
|
|||||||
hideTipWithDelay();
|
hideTipWithDelay();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case QEvent::Leave:
|
case QEvent::Leave:
|
||||||
if (o == m_tip && !m_tip->isAncestorOf(QApplication::focusWidget()))
|
if (o == m_tip && !m_tip->isAncestorOf(QApplication::focusWidget()))
|
||||||
hideTipWithDelay();
|
hideTipWithDelay();
|
||||||
|
Reference in New Issue
Block a user