Fix focus issue in custom scripts editor
This commit is contained in:
parent
c3c9936c67
commit
1454714343
1 changed files with 6 additions and 1 deletions
|
@ -152,6 +152,11 @@ QString CustomScriptsEditor::chooseScript(QString dir) {
|
||||||
|
|
||||||
void CustomScriptsEditor::createNewScript() {
|
void CustomScriptsEditor::createNewScript() {
|
||||||
QString filepath = QFileDialog::getSaveFileName(this, "Create New Script File", this->fileDialogDir + "/new_script.js", "JavaScript Files (*.js)");
|
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())
|
if (filepath.isEmpty())
|
||||||
return;
|
return;
|
||||||
this->fileDialogDir = filepath;
|
this->fileDialogDir = filepath;
|
||||||
|
@ -169,7 +174,7 @@ void CustomScriptsEditor::createNewScript() {
|
||||||
ParseUtil parser;
|
ParseUtil parser;
|
||||||
scriptFile.write(parser.readTextFile(":/text/script_template.txt").toUtf8());
|
scriptFile.write(parser.readTextFile(":/text/script_template.txt").toUtf8());
|
||||||
scriptFile.close();
|
scriptFile.close();
|
||||||
// TODO: When this dialog closes, focus returns to the editor window
|
|
||||||
this->displayNewScript(filepath);
|
this->displayNewScript(filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue