Skip to content

Commit

Permalink
Add "help" and "reset to defaults" actions to label engine settings p…
Browse files Browse the repository at this point in the history
…anel
  • Loading branch information
nyalldawson committed Dec 22, 2019
1 parent d5821fe commit 97e212d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/labeling/qgslabelengineconfigdialog.cpp
Expand Up @@ -22,6 +22,7 @@
#include "qgisapp.h"
#include "qgsmapcanvas.h"
#include "qgsgui.h"
#include "qgsapplication.h"
#include <QPushButton>
#include <QMessageBox>

Expand Down Expand Up @@ -83,6 +84,24 @@ QgsLabelEngineConfigWidget::QgsLabelEngineConfigWidget( QWidget *parent )
connect( mTextRenderFormatComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, &QgsLabelEngineConfigWidget::widgetChanged );
connect( mUnplacedColorButton, &QgsColorButton::colorChanged, this, &QgsLabelEngineConfigWidget::widgetChanged );
connect( mPlacementVersionComboBox, qgis::overload<int>::of( &QComboBox::currentIndexChanged ), this, &QgsLabelEngineConfigWidget::widgetChanged );

mWidgetMenu = new QMenu( this );
QAction *resetAction = new QAction( tr( "Restore Defaults" ), this );
mWidgetMenu->addAction( resetAction );
connect( resetAction, &QAction::triggered, this, &QgsLabelEngineConfigWidget::setDefaults );
QAction *helpAction = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionHelpContents.svg" ) ), tr( "Help…" ), this );
mWidgetMenu->addAction( helpAction );
connect( helpAction, &QAction::triggered, this, &QgsLabelEngineConfigWidget::showHelp );
}

QMenu *QgsLabelEngineConfigWidget::menuButtonMenu()
{
return mWidgetMenu;
}

QString QgsLabelEngineConfigWidget::menuButtonTooltip() const
{
return tr( "Additional Options" );
}

void QgsLabelEngineConfigWidget::apply()
Expand Down
4 changes: 4 additions & 0 deletions src/app/labeling/qgslabelengineconfigdialog.h
Expand Up @@ -29,13 +29,17 @@ class APP_EXPORT QgsLabelEngineConfigWidget : public QgsPanelWidget, private Ui:
public:
QgsLabelEngineConfigWidget( QWidget *parent = nullptr );

QMenu *menuButtonMenu() override;
QString menuButtonTooltip() const override;

public slots:
void apply();
void setDefaults();
void showHelp();

private:
QgsMessageBar *mMessageBar = nullptr;
QMenu *mWidgetMenu = nullptr;

QgsLabelingEngineSettings::PlacementEngineVersion mPreviousEngineVersion = QgsLabelingEngineSettings::PlacementEngineVersion2;
};
Expand Down

0 comments on commit 97e212d

Please sign in to comment.