From 2bd39e264e63ec929f683f4b992f94e2c3f54acf Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 27 May 2015 22:15:22 +0200 Subject: [PATCH] Fix crash if multiple multiline text edtit widgets for the same field are shown Fix #11813 --- src/gui/editorwidgets/qgstexteditwrapper.cpp | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/gui/editorwidgets/qgstexteditwrapper.cpp b/src/gui/editorwidgets/qgstexteditwrapper.cpp index 8d399086b8d..340ddfc46a9 100644 --- a/src/gui/editorwidgets/qgstexteditwrapper.cpp +++ b/src/gui/editorwidgets/qgstexteditwrapper.cpp @@ -130,27 +130,33 @@ void QgsTextEditWrapper::initWidget( QWidget* editor ) } } -void QgsTextEditWrapper::setValue( const QVariant& value ) +void QgsTextEditWrapper::setValue( const QVariant& val ) { QString v; - if ( value.isNull() ) + if ( val.isNull() ) { if ( !( field().type() == QVariant::Int || field().type() == QVariant::Double || field().type() == QVariant::LongLong || field().type() == QVariant::Date ) ) v = QSettings().value( "qgis/nullValue", "NULL" ).toString(); } else - v = value.toString(); + v = val.toString(); if ( mTextEdit ) { - if ( config( "UseHtml" ).toBool() ) - mTextEdit->setHtml( v ); - else - mTextEdit->setPlainText( v ); + if ( val != value() ) + { + if ( config( "UseHtml" ).toBool() ) + mTextEdit->setHtml( v ); + else + mTextEdit->setPlainText( v ); + } } if ( mPlainTextEdit ) - mPlainTextEdit->setPlainText( v ); + { + if ( val != value() ) + mPlainTextEdit->setPlainText( v ); + } if ( mLineEdit ) mLineEdit->setText( v );