From 24fc02df79ddf9c17d46ac5e3f3c4d1157e2b5cd Mon Sep 17 00:00:00 2001 From: Harrissou Sant-anna Date: Thu, 19 Dec 2024 19:23:31 +0100 Subject: [PATCH] Add help button to form other widgets dialogs --- .../vector/qgsattributesformproperties.cpp | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gui/vector/qgsattributesformproperties.cpp b/src/gui/vector/qgsattributesformproperties.cpp index d1a394c8d8f04..3e4f50c3f8ba6 100644 --- a/src/gui/vector/qgsattributesformproperties.cpp +++ b/src/gui/vector/qgsattributesformproperties.cpp @@ -43,6 +43,7 @@ #include "qgsfieldcombobox.h" #include "qgsexpressionfinder.h" #include "qgsexpressionbuilderdialog.h" +#include "qgshelp.h" QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer, QWidget *parent ) : QWidget( parent ) @@ -1497,10 +1498,13 @@ void QgsAttributesDnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int colum emit qmlCode->textChanged(); qmlLayout->addWidget( qmlPreviewBox ); - QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); + QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help ); connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); + connect( buttonBox, &QDialogButtonBox::helpRequested, &dlg, [=] { + QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#other-widgets" ) ); + } ); mainLayout->addWidget( buttonBox ); @@ -1600,10 +1604,13 @@ void QgsAttributesDnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int colum emit htmlCode->textChanged(); htmlLayout->addWidget( htmlPreviewBox ); - QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); + QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help ); connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); + connect( buttonBox, &QDialogButtonBox::helpRequested, &dlg, [=] { + QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#other-widgets" ) ); + } ); mainLayout->addWidget( buttonBox ); @@ -1701,10 +1708,13 @@ void QgsAttributesDnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int colum emit text->textChanged(); textLayout->addWidget( textPreviewBox ); - QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); + QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help ); connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); + connect( buttonBox, &QDialogButtonBox::helpRequested, &dlg, [=] { + QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#other-widgets" ) ); + } ); mainLayout->addWidget( buttonBox ); @@ -1742,11 +1752,13 @@ void QgsAttributesDnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int colum cbLayout->addWidget( new QLabel( tr( "Draw horizontal line" ), &dlg ) ); cbLayout->addWidget( cb ); - - QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); + QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help ); connect( buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept ); connect( buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject ); + connect( buttonBox, &QDialogButtonBox::helpRequested, &dlg, [=] { + QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#other-widgets" ) ); + } ); mainLayout->addWidget( buttonBox );