Skip to content

Commit

Permalink
Add help button to labeling rules dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ authored and nyalldawson committed Dec 17, 2024
1 parent 103990e commit a15b9a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/gui/labeling/qgslabelingengineruleswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "qgslabelingenginerule.h"
#include "qgslabelingenginerulewidget.h"
#include "qgsgui.h"
#include "qgshelp.h"

#include <QMenu>
#include <QAction>
Expand Down Expand Up @@ -408,14 +409,17 @@ QgsLabelingEngineRulesDialog::QgsLabelingEngineRulesDialog( QWidget *parent, Qt:
QVBoxLayout *layout = new QVBoxLayout( this );
layout->addWidget( mWidget );

mButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this );
mButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, Qt::Horizontal, this );
layout->addWidget( mButtonBox );

setLayout( layout );
QgsGui::enableAutoGeometryRestore( this );

connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QDialog::accept );
connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, this, &QDialog::reject );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, [=] {
QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#labeling-rules" ) );
} );
}

void QgsLabelingEngineRulesDialog::setRules( const QList<QgsAbstractLabelingEngineRule *> &rules )
Expand Down
6 changes: 5 additions & 1 deletion src/gui/labeling/qgslabelingenginerulewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "moc_qgslabelingenginerulewidget.cpp"
#include "qgslabelingenginerule_impl.h"
#include "qgsgui.h"
#include "qgshelp.h"

#include <QDialogButtonBox>
#include <QPushButton>
Expand All @@ -36,14 +37,17 @@ QgsLabelingEngineRuleDialog::QgsLabelingEngineRuleDialog( QgsLabelingEngineRuleW
QVBoxLayout *layout = new QVBoxLayout( this );
layout->addWidget( mWidget );

mButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this );
mButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, Qt::Horizontal, this );
layout->addWidget( mButtonBox );

setLayout( layout );
QgsGui::enableAutoGeometryRestore( this );

connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QDialog::accept );
connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, this, &QDialog::reject );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, [=] {
QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#labeling-rules" ) );
} );
}

void QgsLabelingEngineRuleDialog::setRule( const QgsAbstractLabelingEngineRule *rule )
Expand Down
1 change: 0 additions & 1 deletion src/ui/labeling/qgslabelingengineruleswidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
</widget>
<resources>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit a15b9a1

Please sign in to comment.