Skip to content

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

C

Allow Enter in Save File Field to Save (#687)

Jeremy Bullockf3ea7c244fd9
diff --git a/toonz/sources/include/toonzqt/lineedit.h b/toonz/sources/include/toonzqt/lineedit.h
index 7351702cb..88fde3b1c 100644
--- a/toonz/sources/include/toonzqt/lineedit.h
+++ b/toonz/sources/include/toonzqt/lineedit.h
@@ -49,6 +49,7 @@ protected:
signals:
void focusIn();
+ void returnPressedNow();
};
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp
index 4064a89fe..a9d95e66f 100644
--- a/toonz/sources/toonz/filebrowserpopup.cpp
+++ b/toonz/sources/toonz/filebrowserpopup.cpp
@@ -407,7 +407,9 @@ TFilePath GenericLoadFilePopup::getPath() {
//***********************************************************************************
GenericSaveFilePopup::GenericSaveFilePopup(const QString &title)
- : FileBrowserPopup(title) {}
+ : FileBrowserPopup(title) {
+ connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
+}
//-----------------------------------------------------------------------------
@@ -546,6 +548,7 @@ void LoadSubScenePopup::showEvent(QShowEvent *e) {
SaveSceneAsPopup::SaveSceneAsPopup() : FileBrowserPopup(tr("Save Scene")) {
setOkText(tr("Save"));
addFilterType("tnz");
+ connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
}
bool SaveSceneAsPopup::execute() {
@@ -575,6 +578,7 @@ void SaveSceneAsPopup::initFolder() {
SaveSubSceneAsPopup::SaveSubSceneAsPopup()
: FileBrowserPopup(tr("Sub-xsheet")) {
setOkText(tr("Save"));
+ connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
}
bool SaveSubSceneAsPopup::execute() {
@@ -1323,6 +1327,7 @@ void LoadLevelPopup::onSelectionChanged(TSelection *selection) {
SaveLevelAsPopup::SaveLevelAsPopup() : FileBrowserPopup(tr("Save Level")) {
setOkText(tr("Save"));
+ connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
}
bool SaveLevelAsPopup::execute() {
@@ -1603,6 +1608,7 @@ SavePaletteAsPopup::SavePaletteAsPopup()
: FileBrowserPopup(tr("Save Palette")) {
setOkText(tr("Save"));
addFilterType("tpl");
+ connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
}
bool SavePaletteAsPopup::execute() {
diff --git a/toonz/sources/toonzqt/lineedit.cpp b/toonz/sources/toonzqt/lineedit.cpp
index fb82a36a7..743fddbb2 100644
--- a/toonz/sources/toonzqt/lineedit.cpp
+++ b/toonz/sources/toonzqt/lineedit.cpp
@@ -34,6 +34,7 @@ void LineEdit::focusInEvent(QFocusEvent *event) {
void LineEdit::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
m_isReturnPressed = true;
+ emit returnPressedNow();
clearFocus();
return;
} else {