Skip to content
Permalink
Browse files

Read settings for default value

  • Loading branch information
NathanW2 committed Jan 2, 2015
1 parent 53c4c8f commit 731c792dad2f09f305d56be910be868064c0364b
Showing with 10 additions and 8 deletions.
  1. +10 −8 src/app/qgsmeasuredialog.cpp
@@ -43,11 +43,14 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WindowFlags f )
mMeasureArea = tool->measureArea();
mTotal = 0.;

mUnitsCombo->addItem( "Meters");
mUnitsCombo->addItem( "Feet");
mUnitsCombo->addItem( "Degrees");
mUnitsCombo->addItem( "Nautical Miles");
mUnitsCombo->setCurrentIndex( 0 );
mUnitsCombo->addItem( tr( "Meters" ) );
mUnitsCombo->addItem( tr( "Feet" ) );
mUnitsCombo->addItem( tr( "Degrees" ) );
mUnitsCombo->addItem( tr( "Nautical Miles" ) );

QSettings settings;
QString units = settings.value( "/qgis/measure/displayunits", "meters" ).toString();
mUnitsCombo->setCurrentIndex( mUnitsCombo->findText( units, Qt::MatchFixedString ) );

updateSettings();

@@ -60,8 +63,8 @@ void QgsMeasureDialog::updateSettings()

mDecimalPlaces = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();
mCanvasUnits = mTool->canvas()->mapUnits();
mDisplayUnits = QGis::fromLiteral( mUnitsCombo->currentText().toLower() );
// Configure QgsDistanceArea
mDisplayUnits = QGis::fromLiteral( mUnitsCombo->currentText().toLower() );
mDa.setSourceCrs( mTool->canvas()->mapSettings().destinationCrs().srsid() );
mDa.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );
// Only use ellipsoidal calculation when project wide transformation is enabled.
@@ -85,7 +88,7 @@ void QgsMeasureDialog::updateSettings()
updateUi();
}

void QgsMeasureDialog::unitsChanged(const QString &units)
void QgsMeasureDialog::unitsChanged( const QString &units )
{
mDisplayUnits = QGis::fromLiteral( units.toLower() );
mTable->clear();
@@ -237,7 +240,6 @@ QString QgsMeasureDialog::formatDistance( double distance )
QSettings settings;
bool baseUnit = settings.value( "/qgis/measure/keepbaseunit", false ).toBool();

QgsDebugMsg( mUnitsCombo->currentText().toLower() );
QGis::UnitType newDisplayUnits;
convertMeasurement( distance, newDisplayUnits, false );
return QgsDistanceArea::textUnit( distance, mDecimalPlaces, newDisplayUnits, false, baseUnit );

0 comments on commit 731c792

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