|
45 | 45 | #include "qgssymbolselectordialog.h"
|
46 | 46 | #include "qgsrelationmanagerdialog.h"
|
47 | 47 | #include "qgsrelationmanager.h"
|
| 48 | +#include "qgsdoublevalidator.h" |
48 | 49 | #include "qgscolorschemeregistry.h"
|
49 | 50 | #include "qgssymbollayerutils.h"
|
50 | 51 | #include "qgscolordialog.h"
|
@@ -186,6 +187,9 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
|
186 | 187 | connect( radManual, &QAbstractButton::toggled, spinBoxDP, &QWidget::setEnabled );
|
187 | 188 | connect( radManual, &QAbstractButton::toggled, labelDP, &QWidget::setEnabled );
|
188 | 189 |
|
| 190 | + leSemiMajor->setValidator( new QgsDoubleValidator( leSemiMajor ) ); |
| 191 | + leSemiMinor->setValidator( new QgsDoubleValidator( leSemiMinor ) ); |
| 192 | + |
189 | 193 | QgsSettings settings;
|
190 | 194 |
|
191 | 195 | ///////////////////////////////////////////////////////////
|
@@ -1137,8 +1141,17 @@ void QgsProjectProperties::apply()
|
1137 | 1141 | if ( leSemiMajor->isModified() || leSemiMinor->isModified() )
|
1138 | 1142 | {
|
1139 | 1143 | QgsDebugMsgLevel( QStringLiteral( "Using parameteric major/minor" ), 4 );
|
1140 |
| - major = QLocale().toDouble( leSemiMajor->text() ); |
1141 |
| - minor = QLocale().toDouble( leSemiMinor->text() ); |
| 1144 | + bool ok; |
| 1145 | + double val {QgsDoubleValidator::toDouble( leSemiMajor->text(), &ok )}; |
| 1146 | + if ( ok ) |
| 1147 | + { |
| 1148 | + major = val; |
| 1149 | + } |
| 1150 | + val = QgsDoubleValidator::toDouble( leSemiMinor->text(), &ok ); |
| 1151 | + if ( ok ) |
| 1152 | + { |
| 1153 | + minor = val; |
| 1154 | + } |
1142 | 1155 | }
|
1143 | 1156 | QgsProject::instance()->setEllipsoid( QStringLiteral( "PARAMETER:%1:%2" )
|
1144 | 1157 | .arg( major, 0, 'g', 17 )
|
@@ -2439,8 +2452,8 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
|
2439 | 2452 | if ( leSemiMajor->isModified() || leSemiMinor->isModified() )
|
2440 | 2453 | {
|
2441 | 2454 | QgsDebugMsgLevel( QStringLiteral( "Saving major/minor" ), 4 );
|
2442 |
| - mEllipsoidList[ mEllipsoidIndex ].semiMajor = QLocale().toDouble( leSemiMajor->text() ); |
2443 |
| - mEllipsoidList[ mEllipsoidIndex ].semiMinor = QLocale().toDouble( leSemiMinor->text() ); |
| 2455 | + mEllipsoidList[ mEllipsoidIndex ].semiMajor = QgsDoubleValidator::toDouble( leSemiMajor->text() ); |
| 2456 | + mEllipsoidList[ mEllipsoidIndex ].semiMinor = QgsDoubleValidator::toDouble( leSemiMinor->text() ); |
2444 | 2457 | }
|
2445 | 2458 |
|
2446 | 2459 | mEllipsoidIndex = newIndex;
|
|
0 commit comments