From 1a3edecda679455eb20c279f71b6239349f5b07c Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Wed, 22 Jan 2025 18:55:40 +0700 Subject: [PATCH] [annotations] Fix non-HTML formatted annotations losing content on settings change (fixes #59804) --- src/gui/qgsrichtexteditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/qgsrichtexteditor.cpp b/src/gui/qgsrichtexteditor.cpp index d8775783886f..fb7aed3d0f2b 100644 --- a/src/gui/qgsrichtexteditor.cpp +++ b/src/gui/qgsrichtexteditor.cpp @@ -318,12 +318,12 @@ QString QgsRichTextEditor::toHtml() const void QgsRichTextEditor::editSource( bool enabled ) { - if ( enabled ) + if ( enabled && mStackedWidget->currentIndex() == 0 ) { mSourceEdit->setText( mTextEdit->toHtml() ); mStackedWidget->setCurrentIndex( 1 ); } - else + else if ( !enabled && mStackedWidget->currentIndex() == 1 ) { mTextEdit->setHtml( mSourceEdit->text() ); mStackedWidget->setCurrentIndex( 0 );