Skip to content

Commit

Permalink
Add help button when creating/renaming map theme and map view
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ authored and nyalldawson committed Jun 11, 2020
1 parent ae42850 commit db8fa4f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -14566,6 +14566,12 @@ void QgisApp::renameView()
//renameDlg.setHintString( tr( "Name of the new view" ) );
renameDlg.setOverwriteEnabled( false );
renameDlg.setConflictingNameWarning( tr( "A view with this name already exists" ) );
renameDlg.buttonBox()->addButton( QDialogButtonBox::Help );
connect( renameDlg.buttonBox(), &QDialogButtonBox::helpRequested, this, [ = ]
{
QgsHelp::openHelp( QStringLiteral( "introduction/qgis_gui.html#map-view" ) );
} );

if ( renameDlg.exec() || renameDlg.name().isEmpty() )
{
QString newName = renameDlg.name();
Expand Down
11 changes: 10 additions & 1 deletion src/app/qgsmapthemes.cpp
Expand Up @@ -27,8 +27,8 @@
#include "qgsvectorlayer.h"
#include "qgisapp.h"
#include "qgsnewnamedialog.h"
#include "qgshelp.h"

#include <QInputDialog>
#include <QMessageBox>

QgsMapThemes *QgsMapThemes::sInstance;
Expand Down Expand Up @@ -98,6 +98,8 @@ void QgsMapThemes::addPreset()
dlg.setHintString( tr( "Name of the new theme" ) );
dlg.setOverwriteEnabled( false );
dlg.setConflictingNameWarning( tr( "A theme with this name already exists." ) );
dlg.buttonBox()->addButton( QDialogButtonBox::Help );
connect( dlg.buttonBox(), &QDialogButtonBox::helpRequested, this, &QgsMapThemes::showHelp );
if ( dlg.exec() != QDialog::Accepted || dlg.name().isEmpty() )
return;

Expand Down Expand Up @@ -159,6 +161,8 @@ void QgsMapThemes::renameCurrentPreset()
dlg.setHintString( tr( "Enter the new name of the map theme" ) );
dlg.setOverwriteEnabled( false );
dlg.setConflictingNameWarning( tr( "A theme with this name already exists." ) );
dlg.buttonBox()->addButton( QDialogButtonBox::Help );
connect( dlg.buttonBox(), &QDialogButtonBox::helpRequested, this, &QgsMapThemes::showHelp );
if ( dlg.exec() != QDialog::Accepted || dlg.name().isEmpty() )
return;

Expand Down Expand Up @@ -218,3 +222,8 @@ void QgsMapThemes::menuAboutToShow()
mActionRemoveCurrentPreset->setEnabled( hasCurrent );
mActionRenameCurrentPreset->setEnabled( hasCurrent );
}

void QgsMapThemes::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "introduction/general_tools.html#configuring-map-themes" ) );
}
3 changes: 3 additions & 0 deletions src/app/qgsmapthemes.h
Expand Up @@ -71,6 +71,9 @@ class APP_EXPORT QgsMapThemes : public QObject
//! Handles creation of preset menu
void menuAboutToShow();

private slots:
void showHelp();

protected:
QgsMapThemes(); // singleton

Expand Down

0 comments on commit db8fa4f

Please sign in to comment.