Skip to content

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

C

Commit new Cell ID when RenameCellField lost focus, expecting 'Escape' key press

Abel You23ac7e992f35
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index 82ad949e8..d17c27bab 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -993,7 +993,12 @@ void RenameCellField::onReturnPressed() {
void RenameCellField::focusOutEvent(QFocusEvent *e) {
hide();
-
+
+ if (escapePressed) {
+ escapePressed = false;
+ } else {
+ renameCell();
+ }
QLineEdit::focusOutEvent(e);
}
@@ -1036,6 +1041,7 @@ bool RenameCellField::eventFilter(QObject *obj, QEvent *e) {
void RenameCellField::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Escape) {
+ escapePressed = true;
clearFocus();
return;
}
diff --git a/toonz/sources/toonz/xshcellviewer.h b/toonz/sources/toonz/xshcellviewer.h
index f3599bece..7c10c32ea 100644
--- a/toonz/sources/toonz/xshcellviewer.h
+++ b/toonz/sources/toonz/xshcellviewer.h
@@ -40,6 +40,7 @@ class RenameCellField final : public QLineEdit {
int m_row;
int m_col;
+ bool escapePressed = false;
XsheetViewer *m_viewer;
public: