Skip to content
Permalink
Browse files

Fix last segment length in measure dialog is incorrect after

completing measurement with right mouse click

(cherry-picked from bad1372)
  • Loading branch information
nyalldawson committed Oct 6, 2016
1 parent adb6c0a commit d0cc463b19641c2fcf86c72c861c74785463dee3
Showing with 15 additions and 7 deletions.
  1. +15 −7 src/app/qgsmeasuredialog.cpp
@@ -214,16 +214,24 @@ void QgsMeasureDialog::removeLastPoint()
//remove final row
delete mTable->takeTopLevelItem( mTable->topLevelItemCount() - 1 );

QgsPoint p1( mTool->points().last() );
double d = mDa.measureLine( p1, mLastMousePoint );

mTotal = mDa.measureLine( mTool->points() );
editTotal->setText( formatDistance( mTotal + d ) );

d = convertLength( d, mDistanceUnits );
if ( !mTool->done() )
{
// need to add the distance for the temporary mouse cursor point
QgsPoint p1( mTool->points().last() );
double d = mDa.measureLine( p1, mLastMousePoint );

QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', mDecimalPlaces ) );
d = convertLength( d, mDistanceUnits );

QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', mDecimalPlaces ) );
editTotal->setText( formatDistance( mTotal + d ) );
}
else
{
editTotal->setText( formatDistance( mTotal ) );
}
}
}

0 comments on commit d0cc463

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