Commit 8f58aaf9 authored by Daniel Teske's avatar Daniel Teske

MiniProjectTargetSelector: Implement Esc shortcut override

Task-number: QTCREATORBUG-9366

Change-Id: Ic70f3dc63046aafd7de0951395d80c5d7206ef43
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent acf72893
......@@ -615,10 +615,17 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
bool MiniProjectTargetSelector::event(QEvent *event)
{
if (event->type() != QEvent::LayoutRequest)
return QWidget::event(event);
doLayout(true);
return true;
if (event->type() == QEvent::LayoutRequest) {
doLayout(true);
return true;
} else if (event->type() == QEvent::ShortcutOverride) {
if (static_cast<QKeyEvent *>(event)->key() == Qt::Key_Escape) {
event->accept();
return true;
}
}
return QWidget::event(event);
}
class IndexSorter
......@@ -1319,7 +1326,8 @@ void MiniProjectTargetSelector::keyPressEvent(QKeyEvent *ke)
{
if (ke->key() == Qt::Key_Return
|| ke->key() == Qt::Key_Enter
|| ke->key() == Qt::Key_Space)
|| ke->key() == Qt::Key_Space
|| ke->key() == Qt::Key_Escape)
hide();
QWidget::keyPressEvent(ke);
}
......@@ -1337,7 +1345,8 @@ void MiniProjectTargetSelector::keyReleaseEvent(QKeyEvent *ke)
}
if (ke->key() == Qt::Key_Return
|| ke->key() == Qt::Key_Enter
|| ke->key() == Qt::Key_Space)
|| ke->key() == Qt::Key_Space
|| ke->key() == Qt::Key_Escape)
return;
QWidget::keyReleaseEvent(ke);
}
......
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