Skip to content
Permalink
Browse files

preview feature

  • Loading branch information
signedav committed Sep 5, 2018
1 parent df8862b commit ae1333dc06a5c2c1f491532738bc46ba71b893af
Showing with 3 additions and 4 deletions.
  1. +3 −4 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 );

0 comments on commit ae1333d

Please sign in to comment.
You can’t perform that action at this time.