Skip to content

Commit 8b42768

Browse files
committedNov 7, 2022
Cleanup dead code
1 parent 50dc408 commit 8b42768

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed
 

‎src/app/gps/qgsgpstoolbar.cpp

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can
176176
} );
177177

178178
connect( QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::destinationLayerChanged,
179-
this, &QgsGpsToolBar::updateCloseFeatureButton );
179+
this, &QgsGpsToolBar::destinationLayerChanged );
180180

181181
connect( QgsProject::instance()->gpsSettings(), &QgsProjectGpsSettings::automaticallyAddTrackVerticesChanged, this, [ = ]( bool enabled ) { setAddVertexButtonEnabled( !enabled ); } );
182182
setAddVertexButtonEnabled( !QgsProject::instance()->gpsSettings()->automaticallyAddTrackVertices() );
@@ -206,32 +206,17 @@ void QgsGpsToolBar::updateLocationLabel( const QgsPoint &point )
206206
}
207207
}
208208

209-
void QgsGpsToolBar::updateCloseFeatureButton( QgsVectorLayer *vlayer )
209+
void QgsGpsToolBar::destinationLayerChanged( QgsVectorLayer *vlayer )
210210
{
211-
if ( !( vlayer && vlayer->isValid() ) )
211+
if ( vlayer )
212212
{
213-
mAddFeatureAction->setEnabled( false );
214-
return;
213+
215214
}
216215

217-
// Add feature button tracks edit state of layer
218-
if ( vlayer != mLastLayer )
216+
if ( !( vlayer && vlayer->isValid() ) )
219217
{
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;
235220
}
236221

237222
QString buttonLabel = tr( "Create Feature" );
@@ -279,11 +264,6 @@ void QgsGpsToolBar::updateCloseFeatureButton( QgsVectorLayer *vlayer )
279264
mAddFeatureAction->setToolTip( buttonToolTip );
280265
}
281266

282-
void QgsGpsToolBar::layerEditStateChanged()
283-
{
284-
updateCloseFeatureButton( mLastLayer );
285-
}
286-
287267
void QgsGpsToolBar::destinationMenuAboutToShow()
288268
{
289269
mDestinationLayerMenu->clear();

‎src/app/gps/qgsgpstoolbar.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class QgsGpsToolBar : public QToolBar
5151
private slots:
5252

5353
void updateLocationLabel( const QgsPoint &point );
54-
void updateCloseFeatureButton( QgsVectorLayer *lyr );
55-
void layerEditStateChanged();
54+
void destinationLayerChanged( QgsVectorLayer *lyr );
5655
void destinationMenuAboutToShow();
5756

5857
private:
@@ -73,8 +72,6 @@ class QgsGpsToolBar : public QToolBar
7372
QgsCoordinateReferenceSystem mWgs84CRS;
7473
bool mEnableAddVertexButton = true;
7574

76-
QPointer< QgsVectorLayer > mLastLayer;
77-
7875
QgsMapLayerProxyModel *mDestinationLayerModel = nullptr;
7976
};
8077

0 commit comments

Comments
 (0)
Please sign in to comment.