@@ -67,11 +67,6 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
67
67
68
68
mMainWidget ->layout ()->addWidget ( mMapCanvas );
69
69
70
- connect ( mActionSyncView , &QAction::toggled, this , [ = ]
71
- {
72
- syncViewCenter ( mMainCanvas );
73
- } );
74
-
75
70
mMenu = new QMenu ();
76
71
connect ( mMenu , &QMenu::aboutToShow, this , &QgsMapCanvasDockWidget::menuAboutToShow );
77
72
@@ -124,12 +119,18 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
124
119
mActionShowLabels ->setChecked ( true );
125
120
connect ( mActionShowLabels , &QAction::toggled, this , &QgsMapCanvasDockWidget::showLabels );
126
121
122
+ mSyncExtentCheckBox = settingsAction->syncExtentCheckBox ();
127
123
mScaleCombo = settingsAction->scaleCombo ();
128
124
mRotationEdit = settingsAction->rotationSpinBox ();
129
125
mMagnificationEdit = settingsAction->magnifierSpinBox ();
130
126
mSyncScaleCheckBox = settingsAction->syncScaleCheckBox ();
131
127
mScaleFactorWidget = settingsAction->scaleFactorSpinBox ();
132
128
129
+ connect ( mSyncExtentCheckBox , &QCheckBox::toggled, this , [ = ]
130
+ {
131
+ syncViewCenter ( mMainCanvas );
132
+ } );
133
+
133
134
connect ( mScaleCombo , &QgsScaleComboBox::scaleChanged, this , [ = ]( double scale )
134
135
{
135
136
if ( !mBlockScaleUpdate )
@@ -203,7 +204,7 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
203
204
connect ( &mResizeTimer , &QTimer::timeout, this , [ = ]
204
205
{
205
206
mBlockExtentSync = false ;
206
- if ( mActionSyncView ->isChecked () )
207
+ if ( mSyncExtentCheckBox ->isChecked () )
207
208
syncViewCenter ( mMainCanvas );
208
209
} );
209
210
}
@@ -236,12 +237,12 @@ QgsMapCanvas *QgsMapCanvasDockWidget::mapCanvas()
236
237
237
238
void QgsMapCanvasDockWidget::setViewCenterSynchronized ( bool enabled )
238
239
{
239
- mActionSyncView ->setChecked ( enabled );
240
+ mSyncExtentCheckBox ->setChecked ( enabled );
240
241
}
241
242
242
243
bool QgsMapCanvasDockWidget::isViewCenterSynchronized () const
243
244
{
244
- return mActionSyncView ->isChecked ();
245
+ return mSyncExtentCheckBox ->isChecked ();
245
246
}
246
247
247
248
void QgsMapCanvasDockWidget::setCursorMarkerVisible ( bool visible )
@@ -350,7 +351,7 @@ void QgsMapCanvasDockWidget::mapExtentChanged()
350
351
mScaleFactorWidget ->setValue ( newScaleFactor );
351
352
}
352
353
353
- if ( mActionSyncView ->isChecked () )
354
+ if ( mSyncExtentCheckBox ->isChecked () )
354
355
syncViewCenter ( sourceCanvas );
355
356
}
356
357
@@ -477,11 +478,15 @@ QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent )
477
478
{
478
479
QGridLayout *gLayout = new QGridLayout ();
479
480
gLayout ->setContentsMargins ( 3 , 2 , 3 , 2 );
481
+
482
+ mSyncExtentCheckBox = new QCheckBox ( tr ( " Synchronize View Center with Main Map" ) );
483
+ gLayout ->addWidget ( mSyncExtentCheckBox , 0 , 0 , 1 , 2 );
484
+
480
485
QLabel *label = new QLabel ( tr ( " Scale" ) );
481
- gLayout ->addWidget ( label, 0 , 0 );
486
+ gLayout ->addWidget ( label, 1 , 0 );
482
487
483
488
mScaleCombo = new QgsScaleComboBox ();
484
- gLayout ->addWidget ( mScaleCombo , 0 , 1 );
489
+ gLayout ->addWidget ( mScaleCombo , 1 , 1 );
485
490
486
491
mRotationWidget = new QgsDoubleSpinBox ();
487
492
mRotationWidget ->setClearValue ( 0.0 );
@@ -495,8 +500,8 @@ QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent )
495
500
mRotationWidget ->setToolTip ( tr ( " Current clockwise map rotation in degrees" ) );
496
501
497
502
label = new QLabel ( tr ( " Rotation" ) );
498
- gLayout ->addWidget ( label, 1 , 0 );
499
- gLayout ->addWidget ( mRotationWidget , 1 , 1 );
503
+ gLayout ->addWidget ( label, 2 , 0 );
504
+ gLayout ->addWidget ( mRotationWidget , 2 , 1 );
500
505
501
506
QgsSettings settings;
502
507
int minimumFactor = 100 * QgsGuiUtils::CANVAS_MAGNIFICATION_MIN;
@@ -516,11 +521,11 @@ QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent )
516
521
mMagnifierWidget ->setValue ( defaultFactor );
517
522
518
523
label = new QLabel ( tr ( " Magnification" ) );
519
- gLayout ->addWidget ( label, 2 , 0 );
520
- gLayout ->addWidget ( mMagnifierWidget , 2 , 1 );
524
+ gLayout ->addWidget ( label, 3 , 0 );
525
+ gLayout ->addWidget ( mMagnifierWidget , 3 , 1 );
521
526
522
- mSyncScaleCheckBox = new QCheckBox ( tr ( " Synchronize scale " ) );
523
- gLayout ->addWidget ( mSyncScaleCheckBox , 3 , 0 , 1 , 2 );
527
+ mSyncScaleCheckBox = new QCheckBox ( tr ( " Synchronize Scale " ) );
528
+ gLayout ->addWidget ( mSyncScaleCheckBox , 4 , 0 , 1 , 2 );
524
529
525
530
mScaleFactorWidget = new QgsDoubleSpinBox ();
526
531
mScaleFactorWidget ->setSuffix ( trUtf8 ( " ×" ) );
@@ -536,9 +541,9 @@ QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent )
536
541
537
542
connect ( mSyncScaleCheckBox , &QCheckBox::toggled, mScaleFactorWidget , &QgsDoubleSpinBox::setEnabled );
538
543
539
- label = new QLabel ( tr ( " Scale factor " ) );
540
- gLayout ->addWidget ( label, 4 , 0 );
541
- gLayout ->addWidget ( mScaleFactorWidget , 4 , 1 );
544
+ label = new QLabel ( tr ( " Scale Factor " ) );
545
+ gLayout ->addWidget ( label, 5 , 0 );
546
+ gLayout ->addWidget ( mScaleFactorWidget , 5 , 1 );
542
547
543
548
QWidget *w = new QWidget ();
544
549
w->setLayout ( gLayout );
0 commit comments