Skip to content
Permalink
Browse files

Use expression preview for variable values in variable editor widget

Means that values which are non-text, e.g. points, geometries,
lists, maps, etc show a value in the widget
  • Loading branch information
nyalldawson committed Aug 27, 2018
1 parent 05a311b commit 0ad341a01702cc028b2f10f0237b265116dc4535
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/gui/qgsvariableeditorwidget.cpp
@@ -360,8 +360,9 @@ void QgsVariableEditorTree::refreshScopeVariables( QgsExpressionContextScope *sc

item->setFlags( item->flags() | Qt::ItemIsEnabled );
item->setText( 0, name );
QString value = scope->variable( name ).toString();
item->setText( 1, value );
const QVariant value = scope->variable( name );
const QString previewString = QgsExpression::formatPreviewString( value, false );
item->setText( 1, previewString );
QFont font = item->font( 0 );
if ( readOnly || !isCurrent )
{
@@ -385,7 +386,7 @@ void QgsVariableEditorTree::refreshScopeVariables( QgsExpressionContextScope *sc
{
font.setStrikeOut( false );
item->setToolTip( 0, name );
item->setToolTip( 1, value );
item->setToolTip( 1, previewString );
}
item->setFont( 0, font );
item->setFont( 1, font );

0 comments on commit 0ad341a

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