Skip to content

Commit

Permalink
Mark project as dirty when gps settings are changed
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 6, 2022
1 parent 89c1952 commit 3b6434e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/app/gps/qgsappgpssettingsmenu.cpp
Expand Up @@ -183,15 +183,29 @@ QgsAppGpsSettingsMenu::QgsAppGpsSettingsMenu( QWidget *parent )
mAutoAddTrackVerticesAction = new QAction( tr( "Automatically Add Track Vertices" ), this );
mAutoAddTrackVerticesAction->setCheckable( true );
mAutoAddTrackVerticesAction->setChecked( QgsProject::instance()->gpsSettings()->automaticallyAddTrackVertices() );
connect( mAutoAddTrackVerticesAction, &QAction::toggled, QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::setAutomaticallyAddTrackVertices );
connect( mAutoAddTrackVerticesAction, &QAction::toggled, this, [ = ]( bool checked )
{
if ( checked != QgsProject::instance()->gpsSettings()->automaticallyAddTrackVertices() )
{
QgsProject::instance()->gpsSettings()->setAutomaticallyAddTrackVertices( checked );
QgsProject::instance()->setDirty();
}
} );
connect( QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::automaticallyAddTrackVerticesChanged, mAutoAddTrackVerticesAction, &QAction::setChecked );

addAction( mAutoAddTrackVerticesAction );

mAutoSaveAddedFeatureAction = new QAction( tr( "Automatically Save Added Feature" ), this );
mAutoSaveAddedFeatureAction->setCheckable( true );
mAutoSaveAddedFeatureAction->setChecked( QgsProject::instance()->gpsSettings()->automaticallyCommitFeatures() );
connect( mAutoSaveAddedFeatureAction, &QAction::toggled, QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::setAutomaticallyCommitFeatures );
connect( mAutoSaveAddedFeatureAction, &QAction::toggled, this, [ = ]( bool checked )
{
if ( checked != QgsProject::instance()->gpsSettings()->automaticallyCommitFeatures() )
{
QgsProject::instance()->gpsSettings()->setAutomaticallyCommitFeatures( checked );
QgsProject::instance()->setDirty();
}
} );
connect( QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::automaticallyCommitFeaturesChanged, mAutoSaveAddedFeatureAction, &QAction::setChecked );

addAction( mAutoSaveAddedFeatureAction );
Expand Down

0 comments on commit 3b6434e

Please sign in to comment.