@@ -1274,22 +1274,37 @@ void QgisApp::createStatusBar()
1274
1274
mScaleLabel ->setToolTip ( tr ( " Current map scale" ) );
1275
1275
statusBar ()->addPermanentWidget ( mScaleLabel , 0 );
1276
1276
1277
- mScaleEdit = new QLineEdit ( QString (), statusBar () );
1277
+ mScaleEdit = new QComboBox ( statusBar () );
1278
1278
mScaleEdit ->setObjectName ( " mScaleEdit" );
1279
1279
mScaleEdit ->setFont ( myFont );
1280
1280
mScaleEdit ->setMinimumWidth ( 10 );
1281
1281
mScaleEdit ->setMaximumWidth ( 100 );
1282
1282
mScaleEdit ->setMaximumHeight ( 20 );
1283
1283
mScaleEdit ->setContentsMargins ( 0 , 0 , 0 , 0 );
1284
- mScaleEdit ->setAlignment ( Qt::AlignLeft );
1285
1284
// QRegExp validator( "\\d+\\.?\\d*:\\d+\\.?\\d*" );
1286
1285
QRegExp validator ( " \\ d+\\ .?\\ d*:\\ d+\\ .?\\ d*|\\ d+\\ .?\\ d*" );
1287
1286
mScaleEditValidator = new QRegExpValidator ( validator, mScaleEdit );
1288
1287
mScaleEdit ->setValidator ( mScaleEditValidator );
1289
1288
mScaleEdit ->setWhatsThis ( tr ( " Displays the current map scale" ) );
1290
1289
mScaleEdit ->setToolTip ( tr ( " Current map scale (formatted as x:y)" ) );
1290
+
1291
+ // make editable and populate with predefined scales
1292
+ mScaleEdit ->setEditable ( true );
1293
+ mScaleEdit ->addItem ( " 1:1000000" );
1294
+ mScaleEdit ->addItem ( " 1:500000" );
1295
+ mScaleEdit ->addItem ( " 1:250000" );
1296
+ mScaleEdit ->addItem ( " 1:100000" );
1297
+ mScaleEdit ->addItem ( " 1:50000" );
1298
+ mScaleEdit ->addItem ( " 1:25000" );
1299
+ mScaleEdit ->addItem ( " 1:10000" );
1300
+ mScaleEdit ->addItem ( " 1:5000" );
1301
+ mScaleEdit ->addItem ( " 1:2500" );
1302
+ mScaleEdit ->addItem ( " 1:1000" );
1303
+ mScaleEdit ->addItem ( " 1:500" );
1304
+
1291
1305
statusBar ()->addPermanentWidget ( mScaleEdit , 0 );
1292
- connect ( mScaleEdit , SIGNAL ( editingFinished () ), this , SLOT ( userScale () ) );
1306
+ connect ( mScaleEdit , SIGNAL ( currentIndexChanged ( const QString & ) ), this , SLOT ( userScale () ) );
1307
+ connect ( mScaleEdit ->lineEdit (), SIGNAL ( editingFinished () ), this , SLOT ( userScale () ) );
1293
1308
1294
1309
// stop rendering status bar widget
1295
1310
mStopRenderButton = new QToolButton ( statusBar () );
@@ -4347,13 +4362,12 @@ void QgisApp::showMouseCoordinate( const QgsPoint & p )
4347
4362
void QgisApp::showScale ( double theScale )
4348
4363
{
4349
4364
if ( theScale >= 1.0 )
4350
- mScaleEdit ->setText ( " 1:" + QString::number ( theScale, ' f' , 0 ) );
4365
+ mScaleEdit ->setEditText ( " 1:" + QString::number ( theScale, ' f' , 0 ) );
4351
4366
else if ( theScale > 0.0 )
4352
- mScaleEdit ->setText ( QString::number ( 1.0 / theScale, ' f' , 0 ) + " :1" );
4367
+ mScaleEdit ->setEditText ( QString::number ( 1.0 / theScale, ' f' , 0 ) + " :1" );
4353
4368
else
4354
- mScaleEdit ->setText ( tr ( " Invalid scale" ) );
4369
+ mScaleEdit ->setEditText ( tr ( " Invalid scale" ) );
4355
4370
4356
- // Set minimum necessary width
4357
4371
if ( mScaleEdit ->width () > mScaleEdit ->minimumWidth () )
4358
4372
{
4359
4373
mScaleEdit ->setMinimumWidth ( mScaleEdit ->width () );
@@ -4362,7 +4376,7 @@ void QgisApp::showScale( double theScale )
4362
4376
4363
4377
void QgisApp::userScale ()
4364
4378
{
4365
- QStringList parts = mScaleEdit ->text ().split ( ' :' );
4379
+ QStringList parts = mScaleEdit ->currentText ().split ( ' :' );
4366
4380
if ( parts.size () == 2 )
4367
4381
{
4368
4382
bool leftOk, rightOk;
0 commit comments