Skip to content
Permalink
Browse files

Update vector layer variable widget on apply

  • Loading branch information
nyalldawson committed Sep 14, 2015
1 parent 499d0da commit ddb80ebd8a132865329d269c24bab7488ae52575
Showing with 18 additions and 6 deletions.
  1. +14 −6 src/app/qgsvectorlayerproperties.cpp
  2. +4 −0 src/app/qgsvectorlayerproperties.h
@@ -508,12 +508,8 @@ void QgsVectorLayerProperties::syncToLayer( void )
}
}

mVariableEditor->context()->appendScope( QgsExpressionContextUtils::globalScope() );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::projectScope() );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::layerScope( layer ) );
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 2 );

// set initial state for variable editor
updateVariableEditor();
} // syncToLayer()


@@ -626,6 +622,7 @@ void QgsVectorLayerProperties::apply()

//save variables
QgsExpressionContextUtils::setLayerVariables( layer, mVariableEditor->variablesInActiveScope() );
updateVariableEditor();

// update symbology
emit refreshLegend( layer->id() );
@@ -1295,3 +1292,14 @@ void QgsVectorLayerProperties::on_mSimplifyDrawingGroupBox_toggled( bool checked
mSimplifyDrawingAtProvider->setEnabled( checked );
}
}

void QgsVectorLayerProperties::updateVariableEditor()
{
QgsExpressionContext context;
mVariableEditor->setContext( &context );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::globalScope() );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::projectScope() );
mVariableEditor->context()->appendScope( QgsExpressionContextUtils::layerScope( layer ) );
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 2 );
}
@@ -140,6 +140,10 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private

void aboutToShowStyleMenu();

/** Updates the variable editor to reflect layer changes
*/
void updateVariableEditor();

protected:

void saveStyleAs( StyleType styleType );

0 comments on commit ddb80eb

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