Skip to content

Commit b7e24e3

Browse files
committedOct 6, 2016
Fix last segment length in measure dialog is incorrect after
completing measurement with right mouse click (cherry-picked from bad1372)
1 parent d98d24b commit b7e24e3

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed
 

‎src/app/qgsmeasuredialog.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,24 @@ void QgsMeasureDialog::removeLastPoint()
212212
//remove final row
213213
delete mTable->takeTopLevelItem( mTable->topLevelItemCount() - 1 );
214214

215-
QgsPoint p1( mTool->points().last() );
216-
double d = mDa.measureLine( p1, mLastMousePoint );
217-
218215
mTotal = mDa.measureLine( mTool->points() );
219-
editTotal->setText( formatDistance( mTotal + d ) );
220216

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

223-
QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
224-
item->setText( 0, QLocale::system().toString( d, 'f', mDecimalPlaces ) );
223+
d = convertLength( d, mDistanceUnits );
224+
225+
QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
226+
item->setText( 0, QLocale::system().toString( d, 'f', mDecimalPlaces ) );
227+
editTotal->setText( formatDistance( mTotal + d ) );
228+
}
229+
else
230+
{
231+
editTotal->setText( formatDistance( mTotal ) );
232+
}
225233
}
226234
}
227235

0 commit comments

Comments
 (0)