Skip to content
Permalink
Browse files

[processing] Allow help url to be set for models within help edit dialog

Refs #18767
  • Loading branch information
nyalldawson committed Sep 25, 2018
1 parent 95d68e9 commit 844a3fb1b16e18b77d44a78442aa2b3b404a1b45
@@ -53,6 +53,7 @@ class HelpEditionDialog(BASE, WIDGET):
ALG_HELP_CREATOR = 'ALG_HELP_CREATOR'
ALG_VERSION = 'ALG_VERSION'
SHORT_DESCRIPTION = 'SHORT_DESCRIPTION'
HELP_URL = 'HELP_URL'

def __init__(self, alg):
super(HelpEditionDialog, self).__init__(None)
@@ -127,6 +128,9 @@ def fillTree(self):
item = TreeDescriptionItem(self.tr('Algorithm version'),
self.ALG_VERSION)
self.tree.addTopLevelItem(item)
item = TreeDescriptionItem(self.tr('Documentation help URL'),
self.HELP_URL)
self.tree.addTopLevelItem(item)

def changeItem(self):
item = self.tree.currentItem()
@@ -83,7 +83,7 @@ QString QgsProcessingModelAlgorithm::shortDescription() const

QString QgsProcessingModelAlgorithm::helpUrl() const
{
return QString();
return mHelpContent.value( QStringLiteral( "HELP_URL" ) ).toString();
}

QgsProcessingAlgorithm::Flags QgsProcessingModelAlgorithm::flags() const
@@ -5661,6 +5661,18 @@ void TestQgsProcessing::modelerAlgorithm()
alg.setGroup( QStringLiteral( "group2" ) );
QCOMPARE( alg.group(), QStringLiteral( "group2" ) );

QVariantMap help;
alg.setHelpContent( help );
QVERIFY( alg.helpContent().isEmpty() );
QVERIFY( alg.helpUrl().isEmpty() );
QVERIFY( alg.shortDescription().isEmpty() );
help.insert( QStringLiteral( "SHORT_DESCRIPTION" ), QStringLiteral( "short" ) );
help.insert( QStringLiteral( "HELP_URL" ), QStringLiteral( "url" ) );
alg.setHelpContent( help );
QCOMPARE( alg.helpContent(), help );
QCOMPARE( alg.shortDescription(), QStringLiteral( "short" ) );
QCOMPARE( alg.helpUrl(), QStringLiteral( "url" ) );

// child algorithms
QMap<QString, QgsProcessingModelChildAlgorithm> algs;
QgsProcessingModelChildAlgorithm a1;

0 comments on commit 844a3fb

Please sign in to comment.
You can’t perform that action at this time.