Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change elevation profile name #58532

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/app/elevation/qgselevationprofilewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include "qgsexpressioncontextutils.h"
#include "qgsterrainprovider.h"
#include "qgsprofilesourceregistry.h"
#include "qgsnewnamedialog.h"

#include <QToolBar>
#include <QProgressBar>
Expand Down Expand Up @@ -417,6 +418,12 @@ QgsElevationProfileWidget::QgsElevationProfileWidget( const QString &name )

mOptionsMenu->addAction( mSettingsAction );

mOptionsMenu->addSeparator();

mRenameProfileAction = new QAction( tr( "Rename Profile…" ), this );
connect( mRenameProfileAction, &QAction::triggered, this, &QgsElevationProfileWidget::renameProfileTriggered );
mOptionsMenu->addAction( mRenameProfileAction );

mBtnOptions = new QToolButton();
mBtnOptions->setAutoRaise( true );
mBtnOptions->setToolTip( tr( "Options" ) );
Expand Down Expand Up @@ -962,6 +969,18 @@ void QgsElevationProfileWidget::axisScaleLockToggled( bool active )
mCanvas->setLockAxisScales( active );
}

void QgsElevationProfileWidget::renameProfileTriggered()
{
QgsNewNameDialog dlg( tr( "elevation profile" ), canvasName(), {}, {}, Qt::CaseSensitive, this );
dlg.setWindowTitle( tr( "Rename Elevation Profile" ) );
dlg.setHintString( tr( "Enter a new elevation profile title" ) );
dlg.setAllowEmptyName( false );
if ( dlg.exec() == QDialog::Accepted )
{
setCanvasName( dlg.name() );
}
}

void QgsElevationProfileWidget::createOrUpdateRubberBands( )
{
if ( !mRubberBand )
Expand Down
2 changes: 2 additions & 0 deletions src/app/elevation/qgselevationprofilewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class QgsElevationProfileWidget : public QWidget
void nudgeRight();
void nudgeCurve( Qgis::BufferSide side );
void axisScaleLockToggled( bool active );
void renameProfileTriggered();
void onProjectElevationPropertiesChanged();

private:
Expand All @@ -155,6 +156,7 @@ class QgsElevationProfileWidget : public QWidget
QAction *mCaptureCurveFromFeatureAction = nullptr;
QAction *mNudgeLeftAction = nullptr;
QAction *mNudgeRightAction = nullptr;
QAction *mRenameProfileAction = nullptr;
QAction *mLockRatioAction = nullptr;
QMenu *mDistanceUnitMenu = nullptr;

Expand Down
Loading