Skip to content

Commit 3b6434e

Browse files
committedNov 6, 2022
Mark project as dirty when gps settings are changed
1 parent 89c1952 commit 3b6434e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed
 

‎src/app/gps/qgsappgpssettingsmenu.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,29 @@ QgsAppGpsSettingsMenu::QgsAppGpsSettingsMenu( QWidget *parent )
183183
mAutoAddTrackVerticesAction = new QAction( tr( "Automatically Add Track Vertices" ), this );
184184
mAutoAddTrackVerticesAction->setCheckable( true );
185185
mAutoAddTrackVerticesAction->setChecked( QgsProject::instance()->gpsSettings()->automaticallyAddTrackVertices() );
186-
connect( mAutoAddTrackVerticesAction, &QAction::toggled, QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::setAutomaticallyAddTrackVertices );
186+
connect( mAutoAddTrackVerticesAction, &QAction::toggled, this, [ = ]( bool checked )
187+
{
188+
if ( checked != QgsProject::instance()->gpsSettings()->automaticallyAddTrackVertices() )
189+
{
190+
QgsProject::instance()->gpsSettings()->setAutomaticallyAddTrackVertices( checked );
191+
QgsProject::instance()->setDirty();
192+
}
193+
} );
187194
connect( QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::automaticallyAddTrackVerticesChanged, mAutoAddTrackVerticesAction, &QAction::setChecked );
188195

189196
addAction( mAutoAddTrackVerticesAction );
190197

191198
mAutoSaveAddedFeatureAction = new QAction( tr( "Automatically Save Added Feature" ), this );
192199
mAutoSaveAddedFeatureAction->setCheckable( true );
193200
mAutoSaveAddedFeatureAction->setChecked( QgsProject::instance()->gpsSettings()->automaticallyCommitFeatures() );
194-
connect( mAutoSaveAddedFeatureAction, &QAction::toggled, QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::setAutomaticallyCommitFeatures );
201+
connect( mAutoSaveAddedFeatureAction, &QAction::toggled, this, [ = ]( bool checked )
202+
{
203+
if ( checked != QgsProject::instance()->gpsSettings()->automaticallyCommitFeatures() )
204+
{
205+
QgsProject::instance()->gpsSettings()->setAutomaticallyCommitFeatures( checked );
206+
QgsProject::instance()->setDirty();
207+
}
208+
} );
195209
connect( QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::automaticallyCommitFeaturesChanged, mAutoSaveAddedFeatureAction, &QAction::setChecked );
196210

197211
addAction( mAutoSaveAddedFeatureAction );

0 commit comments

Comments
 (0)
Please sign in to comment.