File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -146,26 +146,31 @@ void QgsScaleComboBox::fixupScale()
146
146
{
147
147
double newScale;
148
148
double oldScale = mScale ;
149
- bool ok;
150
- QStringList txtList;
149
+ bool ok, userSetScale;
150
+ QStringList txtList = currentText ().split ( ' :' );
151
+ txtList.size () == 2 ? userSetScale = false : userSetScale = true ;
151
152
152
153
// QgsDebugMsg( QString( "entered with oldScale: %1" ).arg( oldScale ) );
153
154
newScale = toDouble ( currentText (), &ok );
154
- if ( ok )
155
+
156
+ // Valid string representation
157
+ if ( ok && (newScale != oldScale))
155
158
{
156
- // Valid string representation
157
- if ( newScale != oldScale )
159
+ // if a user types scale = 2345, we transform to 1:2345
160
+ if (userSetScale)
161
+ {
162
+ mScale = 1 / newScale;
163
+ }
164
+ else
158
165
{
159
- // Scale has change, update.
160
- // QgsDebugMsg( QString( "New scale OK!: %1" ).arg( newScale ) );
161
166
mScale = newScale;
162
- setScale ( mScale );
163
- emit scaleChanged ();
164
167
}
168
+ setScale ( mScale );
169
+ emit scaleChanged ();
165
170
}
166
171
else
167
172
{
168
- // Invalid string representation
173
+ // Invalid string representation or same scale
169
174
// Reset to the old
170
175
setScale ( mScale );
171
176
}
You can’t perform that action at this time.
0 commit comments