Skip to content

Commit

Permalink
Rename button
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 8, 2022
1 parent ef97a7f commit 61bcc17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions src/app/gps/qgsgpstoolbar.cpp
Expand Up @@ -151,8 +151,8 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can
mRecenterAction->setEnabled( false );
mCreateFeatureAction->setEnabled( false );
mAddTrackVertexAction->setEnabled( false );
delete mLocationButton;
mLocationButton = nullptr;
delete mInformationButton;
mInformationButton = nullptr;
break;
case Qgis::GpsConnectionStatus::Connecting:
whileBlocking( mConnectAction )->setChecked( true );
Expand All @@ -162,8 +162,8 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can
mRecenterAction->setEnabled( false );
mCreateFeatureAction->setEnabled( false );
mAddTrackVertexAction->setEnabled( false );
delete mLocationButton;
mLocationButton = nullptr;
delete mInformationButton;
mInformationButton = nullptr;
break;
case Qgis::GpsConnectionStatus::Connected:
whileBlocking( mConnectAction )->setChecked( true );
Expand Down Expand Up @@ -206,12 +206,12 @@ void QgsGpsToolBar::updateLocationLabel()
const QgsPoint point = mConnection->lastValidLocation();
if ( point.isEmpty() )
{
delete mLocationButton;
mLocationButton = nullptr;
delete mInformationButton;
mInformationButton = nullptr;
}
else
{
if ( !mLocationButton )
if ( !mInformationButton )
{
createLocationWidget();
}
Expand Down Expand Up @@ -250,7 +250,7 @@ void QgsGpsToolBar::updateLocationLabel()
}
}

mLocationButton->setText( parts.join( ' ' ) );
mInformationButton->setText( parts.join( ' ' ) );
}

// this is necessary to ensure that the toolbar in floating mode correctly resizes to fit the label!
Expand Down Expand Up @@ -375,10 +375,10 @@ void QgsGpsToolBar::destinationMenuAboutToShow()

void QgsGpsToolBar::createLocationWidget()
{
mLocationButton = new QToolButton();
mLocationButton->setToolTip( tr( "Current GPS Location" ) );
mInformationButton = new QToolButton();
mInformationButton->setToolTip( tr( "Current GPS Information" ) );

QMenu *locationMenu = new QMenu( mLocationButton );
QMenu *locationMenu = new QMenu( mInformationButton );

const Qgis::GpsInformationComponents visibleComponents = settingShowInToolbar.value();

Expand Down Expand Up @@ -412,10 +412,10 @@ void QgsGpsToolBar::createLocationWidget()
} );
}

mLocationButton->setMenu( locationMenu );
mLocationButton->setAutoRaise( true );
mLocationButton->setPopupMode( QToolButton::ToolButtonPopupMode::InstantPopup );
mInformationButton->setMenu( locationMenu );
mInformationButton->setAutoRaise( true );
mInformationButton->setPopupMode( QToolButton::ToolButtonPopupMode::InstantPopup );

insertWidget( mSettingsMenuAction, mLocationButton );
insertWidget( mSettingsMenuAction, mInformationButton );
}

2 changes: 1 addition & 1 deletion src/app/gps/qgsgpstoolbar.h
Expand Up @@ -78,7 +78,7 @@ class QgsGpsToolBar : public QToolBar

QMenu *mDestinationLayerMenu = nullptr;

QPointer< QToolButton > mLocationButton;
QPointer< QToolButton > mInformationButton;

QgsCoordinateReferenceSystem mWgs84CRS;
bool mEnableAddVertexButton = true;
Expand Down

0 comments on commit 61bcc17

Please sign in to comment.