Fixed Ctrl + F shortcut for full screen toggle in media view.

This commit is contained in:
23rd 2019-02-14 17:27:48 +03:00 committed by John Preston
parent 19bbccd1a7
commit 4ed1835d32
1 changed files with 11 additions and 3 deletions

View File

@ -2487,9 +2487,9 @@ void OverlayWidget::paintThemePreview(Painter &p, QRect clip) {
void OverlayWidget::keyPressEvent(QKeyEvent *e) {
const auto ctrl = e->modifiers().testFlag(Qt::ControlModifier);
if (_clipController) {
auto toggle1 = (e->key() == Qt::Key_F && ctrl);
auto toggle2 = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && (e->modifiers().testFlag(Qt::AltModifier) || ctrl);
if (toggle1 || toggle2) {
// Ctrl + F for full screen toggle is in eventFilter().
const auto toggleFull = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && (e->modifiers().testFlag(Qt::AltModifier) || ctrl);
if (toggleFull) {
onVideoToggleFullScreen();
return;
}
@ -3138,6 +3138,14 @@ bool OverlayWidget::eventHook(QEvent *e) {
bool OverlayWidget::eventFilter(QObject *obj, QEvent *e) {
auto type = e->type();
if (type == QEvent::ShortcutOverride) {
const auto keyEvent = static_cast<QKeyEvent*>(e);
const auto ctrl = keyEvent->modifiers().testFlag(Qt::ControlModifier);
if (keyEvent->key() == Qt::Key_F && ctrl) {
onVideoToggleFullScreen();
}
return true;
}
if ((type == QEvent::MouseMove || type == QEvent::MouseButtonPress || type == QEvent::MouseButtonRelease) && obj->isWidgetType()) {
if (isAncestorOf(static_cast<QWidget*>(obj))) {
const auto mouseEvent = static_cast<QMouseEvent*>(e);