Skip to content

Commit

Permalink
Update tooltip when gps destination layer is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 7, 2022
1 parent 8b42768 commit 29a6ab6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/app/gps/qgsgpstoolbar.cpp
Expand Up @@ -88,13 +88,13 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can
mDestinationLayerMenu = new QMenu( this );
connect( mDestinationLayerMenu, &QMenu::aboutToShow, this, &QgsGpsToolBar::destinationMenuAboutToShow );

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

mAddTrackVertexAction = new QAction( tr( "Add Track Vertex" ), this );
mAddTrackVertexAction->setToolTip( tr( "Add vertex to GPS track using current GPS location" ) );
Expand Down Expand Up @@ -210,7 +210,11 @@ void QgsGpsToolBar::destinationLayerChanged( QgsVectorLayer *vlayer )
{
if ( vlayer )
{

mDestinationLayerButton->setToolTip( tr( "GPS digitized features will be stored in %1" ).arg( vlayer->name() ) );
}
else
{
mDestinationLayerButton->setToolTip( tr( "Set destination layer for GPS digitized features" ) );
}

if ( !( vlayer && vlayer->isValid() ) )
Expand Down
3 changes: 3 additions & 0 deletions src/app/gps/qgsgpstoolbar.h
Expand Up @@ -26,6 +26,7 @@ class QgsMapCanvas;
class QLabel;
class QgsVectorLayer;
class QgsMapLayerProxyModel;
class QToolButton;

class QgsGpsToolBar : public QToolBar
{
Expand Down Expand Up @@ -65,6 +66,8 @@ class QgsGpsToolBar : public QToolBar
QAction *mAddFeatureAction = nullptr;
QAction *mResetFeatureAction = nullptr;

QToolButton *mDestinationLayerButton = nullptr;

QMenu *mDestinationLayerMenu = nullptr;

QLabel *mLocationLabel = nullptr;
Expand Down

0 comments on commit 29a6ab6

Please sign in to comment.