From 0cf474c61f0eb16aa0e2ce4adce52d765e7be886 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 64b1e653de00..8a82ab6b7ad1 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 ) @@ -1507,10 +1508,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 ); @@ -1610,10 +1614,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 ); @@ -1711,10 +1718,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 ); @@ -1752,11 +1762,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 );