Add help button to labeling rules dialogs

This commit is contained in:
Harrissou Sant-anna 2024-12-16 01:15:36 +01:00 committed by Nyall Dawson
parent 103990eabb
commit a15b9a159b
3 changed files with 10 additions and 3 deletions

View File

@ -20,6 +20,7 @@
#include "qgslabelingenginerule.h" #include "qgslabelingenginerule.h"
#include "qgslabelingenginerulewidget.h" #include "qgslabelingenginerulewidget.h"
#include "qgsgui.h" #include "qgsgui.h"
#include "qgshelp.h"
#include <QMenu> #include <QMenu>
#include <QAction> #include <QAction>
@ -408,7 +409,7 @@ QgsLabelingEngineRulesDialog::QgsLabelingEngineRulesDialog( QWidget *parent, Qt:
QVBoxLayout *layout = new QVBoxLayout( this ); QVBoxLayout *layout = new QVBoxLayout( this );
layout->addWidget( mWidget ); 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 ); layout->addWidget( mButtonBox );
setLayout( layout ); setLayout( layout );
@ -416,6 +417,9 @@ QgsLabelingEngineRulesDialog::QgsLabelingEngineRulesDialog( QWidget *parent, Qt:
connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QDialog::accept ); connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QDialog::accept );
connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, this, &QDialog::reject ); 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 ) void QgsLabelingEngineRulesDialog::setRules( const QList<QgsAbstractLabelingEngineRule *> &rules )

View File

@ -17,6 +17,7 @@
#include "moc_qgslabelingenginerulewidget.cpp" #include "moc_qgslabelingenginerulewidget.cpp"
#include "qgslabelingenginerule_impl.h" #include "qgslabelingenginerule_impl.h"
#include "qgsgui.h" #include "qgsgui.h"
#include "qgshelp.h"
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QPushButton> #include <QPushButton>
@ -36,7 +37,7 @@ QgsLabelingEngineRuleDialog::QgsLabelingEngineRuleDialog( QgsLabelingEngineRuleW
QVBoxLayout *layout = new QVBoxLayout( this ); QVBoxLayout *layout = new QVBoxLayout( this );
layout->addWidget( mWidget ); 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 ); layout->addWidget( mButtonBox );
setLayout( layout ); setLayout( layout );
@ -44,6 +45,9 @@ QgsLabelingEngineRuleDialog::QgsLabelingEngineRuleDialog( QgsLabelingEngineRuleW
connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QDialog::accept ); connect( mButtonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QDialog::accept );
connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, this, &QDialog::reject ); 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 ) void QgsLabelingEngineRuleDialog::setRule( const QgsAbstractLabelingEngineRule *rule )

View File

@ -105,7 +105,6 @@
</widget> </widget>
<resources> <resources>
<include location="../../../images/images.qrc"/> <include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>