Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix style shortcut when full screen

shun-iwasawa4f5b7c219d56
diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp
index fdc7b8473..088b7eb45 100644
--- a/toonz/sources/toonz/sceneviewerevents.cpp
+++ b/toonz/sources/toonz/sceneviewerevents.cpp
@@ -16,6 +16,7 @@
#include "comboviewerpane.h"
#include "locatorpopup.h"
#include "cellselection.h"
+#include "styleshortcutswitchablepanel.h"
#if defined(x64)
#include "stopmotion.h"
@@ -1418,6 +1419,15 @@ void SceneViewer::keyPressEvent(QKeyEvent *event) {
event->modifiers() == Qt::KeypadModifier) &&
((Qt::Key_0 <= key && key <= Qt::Key_9) || key == Qt::Key_Tab ||
key == Qt::Key_Backtab)) {
+ // When the viewer is in full screen mode, directly call the style
+ // shortcut function since the viewer is retrieved from the parent
+ // panel.
+ if (parentWidget() &&
+ parentWidget()->windowState() & Qt::WindowFullScreen) {
+ StyleShortcutSwitchablePanel::onKeyPress(event);
+ return true;
+ }
+
event->ignore();
return true;
}
diff --git a/toonz/sources/toonz/styleshortcutswitchablepanel.cpp b/toonz/sources/toonz/styleshortcutswitchablepanel.cpp
index 2ad360722..5e77f314b 100644
--- a/toonz/sources/toonz/styleshortcutswitchablepanel.cpp
+++ b/toonz/sources/toonz/styleshortcutswitchablepanel.cpp
@@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
-void StyleShortcutSwitchablePanel::keyPressEvent(QKeyEvent *event) {
+void StyleShortcutSwitchablePanel::onKeyPress(QKeyEvent *event) {
if (!Preferences::instance()->isUseNumpadForSwitchingStylesEnabled()) return;
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
if (!tool) return;
@@ -57,6 +57,11 @@ void StyleShortcutSwitchablePanel::keyPressEvent(QKeyEvent *event) {
event->accept();
}
}
+//-----------------------------------------------------------------------------
+
+void StyleShortcutSwitchablePanel::keyPressEvent(QKeyEvent *event) {
+ StyleShortcutSwitchablePanel::onKeyPress(event);
+}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/styleshortcutswitchablepanel.h b/toonz/sources/toonz/styleshortcutswitchablepanel.h
index ce689331f..3867fc98d 100644
--- a/toonz/sources/toonz/styleshortcutswitchablepanel.h
+++ b/toonz/sources/toonz/styleshortcutswitchablepanel.h
@@ -26,6 +26,8 @@ public:
TDockWidget::Orientation orientation = TDockWidget::vertical)
: TPanel(parent, flags, orientation) {}
+ static void onKeyPress(QKeyEvent *event);
+
protected:
void keyPressEvent(QKeyEvent *event) override;
void showEvent(QShowEvent *) override;