mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
Secondary canvas extent options should be checkboxes, not radio buttons
Otherwise it is IMPOSSIBLE to disable one of the "sync extent" options after enabling them!
This commit is contained in:
parent
fe3818d37e
commit
cb7416a175
@ -122,29 +122,34 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
|
|||||||
mActionShowLabels->setChecked( true );
|
mActionShowLabels->setChecked( true );
|
||||||
connect( mActionShowLabels, &QAction::toggled, this, &QgsMapCanvasDockWidget::showLabels );
|
connect( mActionShowLabels, &QAction::toggled, this, &QgsMapCanvasDockWidget::showLabels );
|
||||||
|
|
||||||
|
mSyncExtentCheck = settingsAction->syncExtentCheck();
|
||||||
mSyncExtentRadio = settingsAction->syncExtentRadio();
|
mSyncSelectionCheck = settingsAction->syncSelectionCheck();
|
||||||
mSyncSelectionRadio = settingsAction->syncSelectionRadio();
|
|
||||||
mScaleCombo = settingsAction->scaleCombo();
|
mScaleCombo = settingsAction->scaleCombo();
|
||||||
mRotationEdit = settingsAction->rotationSpinBox();
|
mRotationEdit = settingsAction->rotationSpinBox();
|
||||||
mMagnificationEdit = settingsAction->magnifierSpinBox();
|
mMagnificationEdit = settingsAction->magnifierSpinBox();
|
||||||
mSyncScaleCheckBox = settingsAction->syncScaleCheckBox();
|
mSyncScaleCheckBox = settingsAction->syncScaleCheckBox();
|
||||||
mScaleFactorWidget = settingsAction->scaleFactorSpinBox();
|
mScaleFactorWidget = settingsAction->scaleFactorSpinBox();
|
||||||
|
|
||||||
connect( mSyncSelectionRadio, &QRadioButton::toggled, this, [ = ]( bool checked )
|
connect( mSyncSelectionCheck, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||||
{
|
{
|
||||||
autoZoomToSelection( checked );
|
autoZoomToSelection( checked );
|
||||||
if ( checked )
|
if ( checked )
|
||||||
{
|
{
|
||||||
syncSelection();
|
syncSelection();
|
||||||
|
|
||||||
|
// sync extent and selection options are mutually exclusive
|
||||||
|
whileBlocking( mSyncExtentCheck )->setChecked( false );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( mSyncExtentRadio, &QRadioButton::toggled, this, [ = ]( bool checked )
|
connect( mSyncExtentCheck, &QCheckBox::toggled, this, [ = ]( bool checked )
|
||||||
{
|
{
|
||||||
if ( checked )
|
if ( checked )
|
||||||
{
|
{
|
||||||
syncViewCenter( mMainCanvas );
|
syncViewCenter( mMainCanvas );
|
||||||
|
|
||||||
|
// sync extent and selection options are mutually exclusive
|
||||||
|
whileBlocking( mSyncSelectionCheck )->setChecked( false );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -221,7 +226,7 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
|
|||||||
connect( &mResizeTimer, &QTimer::timeout, this, [ = ]
|
connect( &mResizeTimer, &QTimer::timeout, this, [ = ]
|
||||||
{
|
{
|
||||||
mBlockExtentSync = false;
|
mBlockExtentSync = false;
|
||||||
if ( mSyncExtentRadio->isChecked() )
|
if ( mSyncExtentCheck->isChecked() )
|
||||||
syncViewCenter( mMainCanvas );
|
syncViewCenter( mMainCanvas );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -256,22 +261,22 @@ QgsMapCanvas *QgsMapCanvasDockWidget::mapCanvas()
|
|||||||
|
|
||||||
void QgsMapCanvasDockWidget::setViewCenterSynchronized( bool enabled )
|
void QgsMapCanvasDockWidget::setViewCenterSynchronized( bool enabled )
|
||||||
{
|
{
|
||||||
mSyncExtentRadio->setChecked( enabled );
|
mSyncExtentCheck->setChecked( enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsMapCanvasDockWidget::isViewCenterSynchronized() const
|
bool QgsMapCanvasDockWidget::isViewCenterSynchronized() const
|
||||||
{
|
{
|
||||||
return mSyncExtentRadio->isChecked();
|
return mSyncExtentCheck->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsMapCanvasDockWidget::isAutoZoomToSelected() const
|
bool QgsMapCanvasDockWidget::isAutoZoomToSelected() const
|
||||||
{
|
{
|
||||||
return mSyncSelectionRadio->isChecked();
|
return mSyncSelectionCheck->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsMapCanvasDockWidget::setAutoZoomToSelected( bool autoZoom )
|
void QgsMapCanvasDockWidget::setAutoZoomToSelected( bool autoZoom )
|
||||||
{
|
{
|
||||||
mSyncSelectionRadio->setChecked( autoZoom );
|
mSyncSelectionCheck->setChecked( autoZoom );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsMapCanvasDockWidget::setCursorMarkerVisible( bool visible )
|
void QgsMapCanvasDockWidget::setCursorMarkerVisible( bool visible )
|
||||||
@ -391,7 +396,7 @@ void QgsMapCanvasDockWidget::mapExtentChanged()
|
|||||||
mScaleFactorWidget->setValue( newScaleFactor );
|
mScaleFactorWidget->setValue( newScaleFactor );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mSyncExtentRadio->isChecked() )
|
if ( mSyncExtentCheck->isChecked() )
|
||||||
syncViewCenter( sourceCanvas );
|
syncViewCenter( sourceCanvas );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,11 +541,11 @@ QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent )
|
|||||||
QGridLayout *gLayout = new QGridLayout();
|
QGridLayout *gLayout = new QGridLayout();
|
||||||
gLayout->setContentsMargins( 3, 2, 3, 2 );
|
gLayout->setContentsMargins( 3, 2, 3, 2 );
|
||||||
|
|
||||||
mSyncExtentRadio = new QRadioButton( tr( "Synchronize View Center with Main Map" ) );
|
mSyncExtentCheck = new QCheckBox( tr( "Synchronize View Center with Main Map" ) );
|
||||||
gLayout->addWidget( mSyncExtentRadio, 0, 0, 1, 2 );
|
gLayout->addWidget( mSyncExtentCheck, 0, 0, 1, 2 );
|
||||||
|
|
||||||
mSyncSelectionRadio = new QRadioButton( tr( "Synchronize View to Selection" ) );
|
mSyncSelectionCheck = new QCheckBox( tr( "Synchronize View to Selection" ) );
|
||||||
gLayout->addWidget( mSyncSelectionRadio, 1, 0, 1, 2 );
|
gLayout->addWidget( mSyncSelectionCheck, 1, 0, 1, 2 );
|
||||||
|
|
||||||
QLabel *label = new QLabel( tr( "Scale" ) );
|
QLabel *label = new QLabel( tr( "Scale" ) );
|
||||||
gLayout->addWidget( label, 2, 0 );
|
gLayout->addWidget( label, 2, 0 );
|
||||||
|
@ -173,8 +173,8 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM
|
|||||||
QgsMapCanvas *mMainCanvas = nullptr;
|
QgsMapCanvas *mMainCanvas = nullptr;
|
||||||
QMenu *mMenu = nullptr;
|
QMenu *mMenu = nullptr;
|
||||||
QList<QAction *> mMenuPresetActions;
|
QList<QAction *> mMenuPresetActions;
|
||||||
QRadioButton *mSyncExtentRadio = nullptr;
|
QCheckBox *mSyncExtentCheck = nullptr;
|
||||||
QRadioButton *mSyncSelectionRadio = nullptr;
|
QCheckBox *mSyncSelectionCheck = nullptr;
|
||||||
QgsScaleComboBox *mScaleCombo = nullptr;
|
QgsScaleComboBox *mScaleCombo = nullptr;
|
||||||
QgsDoubleSpinBox *mRotationEdit = nullptr;
|
QgsDoubleSpinBox *mRotationEdit = nullptr;
|
||||||
QgsDoubleSpinBox *mMagnificationEdit = nullptr;
|
QgsDoubleSpinBox *mMagnificationEdit = nullptr;
|
||||||
@ -206,8 +206,8 @@ class QgsMapSettingsAction: public QWidgetAction
|
|||||||
|
|
||||||
QgsMapSettingsAction( QWidget *parent = nullptr );
|
QgsMapSettingsAction( QWidget *parent = nullptr );
|
||||||
|
|
||||||
QRadioButton *syncExtentRadio() { return mSyncExtentRadio; }
|
QCheckBox *syncExtentCheck() { return mSyncExtentCheck; }
|
||||||
QRadioButton *syncSelectionRadio() { return mSyncSelectionRadio; }
|
QCheckBox *syncSelectionCheck() { return mSyncSelectionCheck; }
|
||||||
QgsScaleComboBox *scaleCombo() { return mScaleCombo; }
|
QgsScaleComboBox *scaleCombo() { return mScaleCombo; }
|
||||||
QgsDoubleSpinBox *rotationSpinBox() { return mRotationWidget; }
|
QgsDoubleSpinBox *rotationSpinBox() { return mRotationWidget; }
|
||||||
QgsDoubleSpinBox *magnifierSpinBox() { return mMagnifierWidget; }
|
QgsDoubleSpinBox *magnifierSpinBox() { return mMagnifierWidget; }
|
||||||
@ -215,8 +215,8 @@ class QgsMapSettingsAction: public QWidgetAction
|
|||||||
QCheckBox *syncScaleCheckBox() { return mSyncScaleCheckBox; }
|
QCheckBox *syncScaleCheckBox() { return mSyncScaleCheckBox; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QRadioButton *mSyncSelectionRadio = nullptr;
|
QCheckBox *mSyncSelectionCheck = nullptr;
|
||||||
QRadioButton *mSyncExtentRadio = nullptr;
|
QCheckBox *mSyncExtentCheck = nullptr;
|
||||||
QgsScaleComboBox *mScaleCombo = nullptr;
|
QgsScaleComboBox *mScaleCombo = nullptr;
|
||||||
QgsDoubleSpinBox *mRotationWidget = nullptr;
|
QgsDoubleSpinBox *mRotationWidget = nullptr;
|
||||||
QgsDoubleSpinBox *mMagnifierWidget = nullptr;
|
QgsDoubleSpinBox *mMagnifierWidget = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user