Commit 9f5c0502 authored by Michael Augaitis's avatar Michael Augaitis Committed by Albert Astals Cid
Browse files

Make ESC key leave fullscreen

BUG: 366276, 417337, 269677
parent 53a9f566
Pipeline #50363 passed with stage
in 10 minutes and 26 seconds
......@@ -295,7 +295,7 @@ bool AnnotWindow::eventFilter(QObject *o, QEvent *e)
if (e->type() == QEvent::ShortcutOverride) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(e);
if (keyEvent->key() == Qt::Key_Escape) {
close();
e->accept();
return true;
}
} else if (e->type() == QEvent::KeyPress) {
......@@ -306,6 +306,9 @@ bool AnnotWindow::eventFilter(QObject *o, QEvent *e)
} else if (keyEvent == QKeySequence::Redo) {
m_document->redo();
return true;
} else if (keyEvent->key() == Qt::Key_Escape) {
close();
return true;
}
} else if (e->type() == QEvent::FocusIn) {
raise();
......
......@@ -1972,7 +1972,12 @@ void PageView::resizeEvent(QResizeEvent *e)
void PageView::keyPressEvent(QKeyEvent *e)
{
e->accept();
// Ignore ESC key press to send to shell.cpp
if (e->key() != Qt::Key_Escape) {
e->accept();
} else {
e->ignore();
}
// if performing a selection or dyn zooming, disable keys handling
if ((d->mouseSelecting && e->key() != Qt::Key_Escape) || (QApplication::mouseButtons() & Qt::MiddleButton))
......
......@@ -160,6 +160,13 @@ void Shell::reloadAllXML()
}
}
void Shell::keyPressEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_Escape && window()->isFullScreen()) {
setFullScreen(false);
}
}
bool Shell::eventFilter(QObject *obj, QEvent *event)
{
QDragMoveEvent *dmEvent = dynamic_cast<QDragMoveEvent *>(event);
......
......@@ -114,6 +114,7 @@ protected:
bool queryClose() override;
void showEvent(QShowEvent *event) override;
void keyPressEvent(QKeyEvent *) override;
private Q_SLOTS:
void fileOpen();
......
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