Skip to content

Commit 204cfa9

Browse files
author
homann
committedJan 1, 2007
Merged r6365 from 0.8 release
git-svn-id: http://svn.osgeo.org/qgis/trunk@6366 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 23f0177 commit 204cfa9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
 

‎src/gui/qgsmeasure.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ QgsMeasure::QgsMeasure(bool measureArea, QgsMapCanvas *mc, Qt::WFlags f)
4545

4646
mTable->setLeftMargin(0); // hide row labels
4747

48+
// Set one cell row where to update current distance
49+
// If measuring area, the table doesn't get shown
50+
mTable->setNumRows(1);
51+
mTable->setText(0, 0, QString::number(0, 'f',1));
52+
4853
mTable->horizontalHeader()->setLabel( 0, tr("Segments (in meters)") );
4954
//mTable->horizontalHeader()->setLabel( 1, tr("Total") );
5055
//mTable->horizontalHeader()->setLabel( 2, tr("Azimuth") );
@@ -121,7 +126,10 @@ QgsMeasure::~QgsMeasure()
121126
void QgsMeasure::restart(void )
122127
{
123128
mPoints.resize(0);
124-
mTable->setNumRows(0);
129+
// Set one cell row where to update current distance
130+
// If measuring area, the table doesn't get shown
131+
mTable->setNumRows(1);
132+
mTable->setText(0, 0, QString::number(0, 'f',1));
125133
mTotal = 0.;
126134

127135
updateUi();
@@ -160,13 +168,14 @@ void QgsMeasure::addPoint(QgsPoint &point)
160168
mTotal += d;
161169
editTotal->setText(formatDistance(mTotal));
162170

163-
mTable->setNumRows ( mPoints.size()-1 );
164171

165172
int row = mPoints.size()-2;
166173
mTable->setText(row, 0, QString::number(d, 'f',1));
167174
//mTable->setText ( row, 1, QString::number(mTotal) );
175+
mTable->setNumRows ( mPoints.size() );
168176

169-
mTable->ensureCellVisible(row,0);
177+
mTable->setText(row + 1, 0, QString::number(0, 'f',1));
178+
mTable->ensureCellVisible(row + 1,0);
170179
}
171180

172181
mRubberBand->addPoint(point);
@@ -208,6 +217,7 @@ void QgsMeasure::mouseMove(QgsPoint &point)
208217
QgsPoint p1 = tmpPoints[last], p2 = tmpPoints[last+1];
209218

210219
double d = mCalc->measureLine(p1,p2);
220+
mTable->setText(last, 0, QString::number(d, 'f',1));
211221
editTotal->setText(formatDistance(mTotal + d));
212222
}
213223
}

0 commit comments

Comments
 (0)
Please sign in to comment.