From 1454714343b35313b7173fdff0ceca1ceb47a932 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 3 Nov 2023 14:34:41 -0400 Subject: [PATCH] Fix focus issue in custom scripts editor --- src/ui/customscriptseditor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/customscriptseditor.cpp b/src/ui/customscriptseditor.cpp index bbbbfc03..1e72d268 100644 --- a/src/ui/customscriptseditor.cpp +++ b/src/ui/customscriptseditor.cpp @@ -152,6 +152,11 @@ QString CustomScriptsEditor::chooseScript(QString dir) { void CustomScriptsEditor::createNewScript() { QString filepath = QFileDialog::getSaveFileName(this, "Create New Script File", this->fileDialogDir + "/new_script.js", "JavaScript Files (*.js)"); + + // QFileDialog::getSaveFileName returns focus to the main editor window when closed. Workaround for this below + this->raise(); + this->activateWindow(); + if (filepath.isEmpty()) return; this->fileDialogDir = filepath; @@ -169,7 +174,7 @@ void CustomScriptsEditor::createNewScript() { ParseUtil parser; scriptFile.write(parser.readTextFile(":/text/script_template.txt").toUtf8()); scriptFile.close(); - // TODO: When this dialog closes, focus returns to the editor window + this->displayNewScript(filepath); }