Skip to content

Commit 29a6ab6

Browse files
committedNov 7, 2022
Update tooltip when gps destination layer is changed
1 parent 8b42768 commit 29a6ab6

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed
 

‎src/app/gps/qgsgpstoolbar.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can
8888
mDestinationLayerMenu = new QMenu( this );
8989
connect( mDestinationLayerMenu, &QMenu::aboutToShow, this, &QgsGpsToolBar::destinationMenuAboutToShow );
9090

91-
QToolButton *destinationLayerButton = new QToolButton();
92-
destinationLayerButton->setAutoRaise( true );
93-
destinationLayerButton->setToolTip( tr( "Set destination layer for GPS digitized features" ) );
94-
destinationLayerButton->setMenu( mDestinationLayerMenu );
95-
destinationLayerButton->setPopupMode( QToolButton::InstantPopup );
96-
destinationLayerButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
97-
addWidget( destinationLayerButton );
91+
mDestinationLayerButton = new QToolButton();
92+
mDestinationLayerButton->setAutoRaise( true );
93+
mDestinationLayerButton->setToolTip( tr( "Set destination layer for GPS digitized features" ) );
94+
mDestinationLayerButton->setMenu( mDestinationLayerMenu );
95+
mDestinationLayerButton->setPopupMode( QToolButton::InstantPopup );
96+
mDestinationLayerButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
97+
addWidget( mDestinationLayerButton );
9898

9999
mAddTrackVertexAction = new QAction( tr( "Add Track Vertex" ), this );
100100
mAddTrackVertexAction->setToolTip( tr( "Add vertex to GPS track using current GPS location" ) );
@@ -210,7 +210,11 @@ void QgsGpsToolBar::destinationLayerChanged( QgsVectorLayer *vlayer )
210210
{
211211
if ( vlayer )
212212
{
213-
213+
mDestinationLayerButton->setToolTip( tr( "GPS digitized features will be stored in %1" ).arg( vlayer->name() ) );
214+
}
215+
else
216+
{
217+
mDestinationLayerButton->setToolTip( tr( "Set destination layer for GPS digitized features" ) );
214218
}
215219

216220
if ( !( vlayer && vlayer->isValid() ) )

‎src/app/gps/qgsgpstoolbar.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class QgsMapCanvas;
2626
class QLabel;
2727
class QgsVectorLayer;
2828
class QgsMapLayerProxyModel;
29+
class QToolButton;
2930

3031
class QgsGpsToolBar : public QToolBar
3132
{
@@ -65,6 +66,8 @@ class QgsGpsToolBar : public QToolBar
6566
QAction *mAddFeatureAction = nullptr;
6667
QAction *mResetFeatureAction = nullptr;
6768

69+
QToolButton *mDestinationLayerButton = nullptr;
70+
6871
QMenu *mDestinationLayerMenu = nullptr;
6972

7073
QLabel *mLocationLabel = nullptr;

0 commit comments

Comments
 (0)
Please sign in to comment.