@@ -176,7 +176,7 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can
176
176
} );
177
177
178
178
connect ( QgsProject::instance ()->gpsSettings (), &QgsProjectGpsSettings::destinationLayerChanged,
179
- this , &QgsGpsToolBar::updateCloseFeatureButton );
179
+ this , &QgsGpsToolBar::destinationLayerChanged );
180
180
181
181
connect ( QgsProject::instance ()->gpsSettings (), &QgsProjectGpsSettings::automaticallyAddTrackVerticesChanged, this , [ = ]( bool enabled ) { setAddVertexButtonEnabled ( !enabled ); } );
182
182
setAddVertexButtonEnabled ( !QgsProject::instance ()->gpsSettings ()->automaticallyAddTrackVertices () );
@@ -206,32 +206,17 @@ void QgsGpsToolBar::updateLocationLabel( const QgsPoint &point )
206
206
}
207
207
}
208
208
209
- void QgsGpsToolBar::updateCloseFeatureButton ( QgsVectorLayer *vlayer )
209
+ void QgsGpsToolBar::destinationLayerChanged ( QgsVectorLayer *vlayer )
210
210
{
211
- if ( !( vlayer && vlayer-> isValid () ) )
211
+ if ( vlayer )
212
212
{
213
- mAddFeatureAction ->setEnabled ( false );
214
- return ;
213
+
215
214
}
216
215
217
- // Add feature button tracks edit state of layer
218
- if ( vlayer != mLastLayer )
216
+ if ( !( vlayer && vlayer->isValid () ) )
219
217
{
220
- if ( mLastLayer ) // disconnect previous layer
221
- {
222
- disconnect ( mLastLayer , &QgsVectorLayer::editingStarted,
223
- this , &QgsGpsToolBar::layerEditStateChanged );
224
- disconnect ( mLastLayer , &QgsVectorLayer::editingStopped,
225
- this , &QgsGpsToolBar::layerEditStateChanged );
226
- }
227
- if ( vlayer ) // connect new layer
228
- {
229
- connect ( vlayer, &QgsVectorLayer::editingStarted,
230
- this , &QgsGpsToolBar::layerEditStateChanged );
231
- connect ( vlayer, &QgsVectorLayer::editingStopped,
232
- this , &QgsGpsToolBar::layerEditStateChanged );
233
- }
234
- mLastLayer = vlayer;
218
+ mAddFeatureAction ->setEnabled ( false );
219
+ return ;
235
220
}
236
221
237
222
QString buttonLabel = tr ( " Create Feature" );
@@ -279,11 +264,6 @@ void QgsGpsToolBar::updateCloseFeatureButton( QgsVectorLayer *vlayer )
279
264
mAddFeatureAction ->setToolTip ( buttonToolTip );
280
265
}
281
266
282
- void QgsGpsToolBar::layerEditStateChanged ()
283
- {
284
- updateCloseFeatureButton ( mLastLayer );
285
- }
286
-
287
267
void QgsGpsToolBar::destinationMenuAboutToShow ()
288
268
{
289
269
mDestinationLayerMenu ->clear ();
0 commit comments