Commit f5cb19e8 authored by Michael Augaitis's avatar Michael Augaitis Committed by Nate Graham

Fix ESC key not exiting fullscreen when viewing image

The event filter was not catching the QEvent::ShortcutOverride
event in browsemainpage.cpp and therefore when the ESC
key was pressed, gwenview would browse images instead
of leaving fullscreen. This commit ensures that when
the ESC key is pressed the first time, gwenview will
exit fullscreen and will browse images on second key
press.

BUG: 425479
parent 31a9d54b
......@@ -390,6 +390,7 @@ void BrowseMainPage::saveConfig() const
bool BrowseMainPage::eventFilter(QObject* watched, QEvent* event)
{
// Leave fullscreen when not viewing an image
if (window()->isFullScreen() && event->type() == QEvent::ShortcutOverride) {
const QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Escape) {
......@@ -397,7 +398,6 @@ bool BrowseMainPage::eventFilter(QObject* watched, QEvent* event)
event->accept();
}
}
return QWidget::eventFilter(watched, event);
}
......
......@@ -815,6 +815,11 @@ bool ViewMainPage::eventFilter(QObject* watched, QEvent* event)
}
}
}
// Leave fullscreen when viewing an image
if (window()->isFullScreen() && key == Qt::Key_Escape) {
d->mActionCollection->action("leave_fullscreen")->trigger();
event->accept();
}
}
return QWidget::eventFilter(watched, event);
......
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