Skip to content


Pass distance area into field calc bar
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed May 26, 2014
1 parent c5bde9b commit dcbf893
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid

QgsAttributeEditorContext context;

QgsDistanceArea myDa;
myDa = new QgsDistanceArea();

myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() );
myDa.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );
myDa->setSourceCrs( mLayer->crs() );
myDa->setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() );
myDa->setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );

context.setDistanceArea( myDa );
context.setDistanceArea( *myDa );
context.setVectorLayerTools( QgisApp::instance()->vectorLayerTools() );

// Initialize dual view
Expand Down Expand Up @@ -303,6 +303,7 @@ void QgsAttributeTableDialog::updateFieldFromExpression()
QString error;

QgsExpression exp( mUpdateExpressionText->text() );
exp.setGeomCalculator( *myDa );
bool useGeometry = exp.needsGeometry();

QgsFeatureRequest request;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsattributetabledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
QAction* mActionToggleEditing;

QDockWidget* mDock;
QgsDistanceArea* myDa;

QMenu* mFilterColumnsMenu;
QSignalMapper* mFilterActionMapper;
Expand Down

1 comment on commit dcbf893

Copy link

@m-kuhn m-kuhn commented on dcbf893 Jun 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this leak memory?
Is there a reason to create it with new? If creating with new I think there should be an appropriate delete as well.

Please sign in to comment.