Skip to content

Commit bad1372

Browse files
committedOct 5, 2016
Fix last segment length in measure dialog is incorrect after
completing measurement with right mouse click
1 parent 03bff50 commit bad1372

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

216-
QgsPoint p1( mTool->points().last() );
217-
double d = mDa.measureLine( p1, mLastMousePoint );
218-
219216
mTotal = mDa.measureLine( mTool->points() );
220-
editTotal->setText( formatDistance( mTotal + d ) );
221217

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

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

1 commit comments

Comments
 (1)

3nids commented on Oct 5, 2016

@3nids
Member

oh! I tried once to change the behavior of the map tool so that the right-click finishes without adding point (to be coherent with add line/polygon) but I end up on this issue... I will resurrect this, thanks!

Please sign in to comment.