Skip to content
Permalink
Browse files

Add "help" and "reset to defaults" actions to label engine settings p…

…anel
  • Loading branch information
nyalldawson committed Dec 22, 2019
1 parent d5821fe commit 97e212d753ccb029a8b2090bcd37259cf7f6b449
Showing with 23 additions and 0 deletions.
  1. +19 −0 src/app/labeling/qgslabelengineconfigdialog.cpp
  2. +4 −0 src/app/labeling/qgslabelengineconfigdialog.h
@@ -22,6 +22,7 @@
#include "qgisapp.h"
#include "qgsmapcanvas.h"
#include "qgsgui.h"
#include "qgsapplication.h"
#include <QPushButton>
#include <QMessageBox>

@@ -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()
@@ -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;
};

0 comments on commit 97e212d

Please sign in to comment.
You can’t perform that action at this time.