From 84330135cff6c5624ff84f1713ec821c06bdbde8 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 15 Nov 2024 13:12:14 +0700 Subject: [PATCH] [code editors] Fix python console editor's modified content lost when switching to another app --- src/gui/codeeditors/qgscodeeditorwidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/codeeditors/qgscodeeditorwidget.cpp b/src/gui/codeeditors/qgscodeeditorwidget.cpp index 930de300b593..324fcf1ebad5 100644 --- a/src/gui/codeeditors/qgscodeeditorwidget.cpp +++ b/src/gui/codeeditors/qgscodeeditorwidget.cpp @@ -418,10 +418,10 @@ bool QgsCodeEditorWidget::loadFile( const QString &path ) { const QString content = file.readAll(); mEditor->setText( content ); - mEditor->setModified( false ); + setFilePath( path ); mEditor->recolor(); + mEditor->setModified( false ); mLastModified = QFileInfo( path ).lastModified(); - setFilePath( path ); return true; } return false; @@ -449,9 +449,9 @@ bool QgsCodeEditorWidget::save( const QString &path ) file.write( mEditor->text().toUtf8() ); file.close(); + setFilePath( filePath ); mEditor->setModified( false ); mLastModified = QFileInfo( filePath ).lastModified(); - setFilePath( filePath ); return true; }