Skip to content

Commit 61c0f18

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 f327bf5 commit 61c0f18

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
@@ -214,16 +214,24 @@ void QgsMeasureDialog::removeLastPoint()
214214
//remove final row
215215
delete mTable->takeTopLevelItem( mTable->topLevelItemCount() - 1 );
216216

217-
QgsPoint p1( mTool->points().last() );
218-
double d = mDa.measureLine( p1, mLastMousePoint );
219-
220217
mTotal = mDa.measureLine( mTool->points() );
221-
editTotal->setText( formatDistance( mTotal + d ) );
222218

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.