From 7b207a795468c7f9603655722f33a54a2476de52 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 17 May 2015 14:31:53 +0200 Subject: [PATCH] added shortcut for closing subviews (Fixes #2558) --- apps/opencs/view/doc/subview.cpp | 18 ++++++++++++++++++ apps/opencs/view/doc/subview.hpp | 2 ++ 2 files changed, 20 insertions(+) diff --git a/apps/opencs/view/doc/subview.cpp b/apps/opencs/view/doc/subview.cpp index df1e7ee49..f4f0c6afe 100644 --- a/apps/opencs/view/doc/subview.cpp +++ b/apps/opencs/view/doc/subview.cpp @@ -2,6 +2,24 @@ #include "view.hpp" +#include +#include +#include + +bool CSVDoc::SubView::event (QEvent *event) +{ + if (event->type()==QEvent::ShortcutOverride) + { + QKeyEvent *keyEvent = static_cast (event); + + if (keyEvent->key()==Qt::Key_W && keyEvent->modifiers()==(Qt::ShiftModifier | Qt::ControlModifier)) + emit closeRequest(); + return true; + } + + return QDockWidget::event (event); +} + CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) : mUniversalId (id) { diff --git a/apps/opencs/view/doc/subview.hpp b/apps/opencs/view/doc/subview.hpp index a8aa3cda1..b323f9ed9 100644 --- a/apps/opencs/view/doc/subview.hpp +++ b/apps/opencs/view/doc/subview.hpp @@ -34,6 +34,8 @@ namespace CSVDoc void setUniversalId(const CSMWorld::UniversalId& id); + bool event (QEvent *event); + public: SubView (const CSMWorld::UniversalId& id);