Skip to content

Commit 844a3fb

Browse files
committedSep 25, 2018
[processing] Allow help url to be set for models within help edit dialog
Refs #18767
1 parent 95d68e9 commit 844a3fb

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed
 

‎python/plugins/processing/gui/HelpEditionDialog.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class HelpEditionDialog(BASE, WIDGET):
5353
ALG_HELP_CREATOR = 'ALG_HELP_CREATOR'
5454
ALG_VERSION = 'ALG_VERSION'
5555
SHORT_DESCRIPTION = 'SHORT_DESCRIPTION'
56+
HELP_URL = 'HELP_URL'
5657

5758
def __init__(self, alg):
5859
super(HelpEditionDialog, self).__init__(None)
@@ -127,6 +128,9 @@ def fillTree(self):
127128
item = TreeDescriptionItem(self.tr('Algorithm version'),
128129
self.ALG_VERSION)
129130
self.tree.addTopLevelItem(item)
131+
item = TreeDescriptionItem(self.tr('Documentation help URL'),
132+
self.HELP_URL)
133+
self.tree.addTopLevelItem(item)
130134

131135
def changeItem(self):
132136
item = self.tree.currentItem()

‎src/core/processing/models/qgsprocessingmodelalgorithm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ QString QgsProcessingModelAlgorithm::shortDescription() const
8383

8484
QString QgsProcessingModelAlgorithm::helpUrl() const
8585
{
86-
return QString();
86+
return mHelpContent.value( QStringLiteral( "HELP_URL" ) ).toString();
8787
}
8888

8989
QgsProcessingAlgorithm::Flags QgsProcessingModelAlgorithm::flags() const

‎tests/src/analysis/testqgsprocessing.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5661,6 +5661,18 @@ void TestQgsProcessing::modelerAlgorithm()
56615661
alg.setGroup( QStringLiteral( "group2" ) );
56625662
QCOMPARE( alg.group(), QStringLiteral( "group2" ) );
56635663

5664+
QVariantMap help;
5665+
alg.setHelpContent( help );
5666+
QVERIFY( alg.helpContent().isEmpty() );
5667+
QVERIFY( alg.helpUrl().isEmpty() );
5668+
QVERIFY( alg.shortDescription().isEmpty() );
5669+
help.insert( QStringLiteral( "SHORT_DESCRIPTION" ), QStringLiteral( "short" ) );
5670+
help.insert( QStringLiteral( "HELP_URL" ), QStringLiteral( "url" ) );
5671+
alg.setHelpContent( help );
5672+
QCOMPARE( alg.helpContent(), help );
5673+
QCOMPARE( alg.shortDescription(), QStringLiteral( "short" ) );
5674+
QCOMPARE( alg.helpUrl(), QStringLiteral( "url" ) );
5675+
56645676
// child algorithms
56655677
QMap<QString, QgsProcessingModelChildAlgorithm> algs;
56665678
QgsProcessingModelChildAlgorithm a1;

0 commit comments

Comments
 (0)
Please sign in to comment.