From ae1333dc06a5c2c1f491532738bc46ba71b893af Mon Sep 17 00:00:00 2001 From: signedav Date: Wed, 5 Sep 2018 10:59:26 +0200 Subject: [PATCH] preview feature --- src/app/qgsattributesformproperties.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/qgsattributesformproperties.cpp b/src/app/qgsattributesformproperties.cpp index 6f36d933ee8..a6c37b90d0a 100644 --- a/src/app/qgsattributesformproperties.cpp +++ b/src/app/qgsattributesformproperties.cpp @@ -1126,13 +1126,12 @@ void DnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int column ) QgsQmlWidgetWrapper *qmlWrapper = new QgsQmlWidgetWrapper( mLayer, nullptr, this ); qmlWrapper->setQmlCode( qmlCode->toPlainText() ); //update preview on text change - QgsFeature previewFeature; - mLayer->getFeatures().nextFeature( previewFeature ); - qmlWrapper->setFeature( previewFeature ); connect( qmlCode, &QPlainTextEdit::textChanged, this, [ = ] { qmlWrapper->setQmlCode( qmlCode->toPlainText() ); qmlWrapper->reinitWidget(); + QgsFeature previewFeature; + mLayer->getFeatures().nextFeature( previewFeature ); qmlWrapper->setFeature( previewFeature ); } ); @@ -1216,7 +1215,7 @@ void DnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int column ) connect( addExpressionButton, &QAbstractButton::clicked, this, [ = ] { - qmlCode->insertPlainText( QStringLiteral( "expression.evaluate(\"%1\")" ).arg( expressionWidget->currentText() ) ); + qmlCode->insertPlainText( QStringLiteral( "expression.evaluate(\"%1\")" ).arg( expressionWidget->currentText().replace( '"', "\\\"" ) ) ); } ); layout->addRow( tr( "Title" ), title );