Skip to content

Commit 4ce1662

Browse files
committed
Allow processing providers to specify a long name, and show it in tooltips
Add version number to gdal provider long name
1 parent a33376f commit 4ce1662

File tree

5 files changed

+40
-4
lines changed

5 files changed

+40
-4
lines changed

python/core/processing/qgsprocessingprovider.sip

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,22 @@ class QgsProcessingProvider : QObject
5656

5757
virtual QString name() const = 0;
5858
%Docstring
59-
Returns the full provider name, which is used to describe the provider within the GUI.
59+
Returns the provider name, which is used to describe the provider within the GUI.
60+
This string should be short (e.g. "Lastools") and localised.
61+
.. seealso:: longName()
62+
.. seealso:: id()
63+
:rtype: str
64+
%End
65+
66+
virtual QString longName() const;
67+
%Docstring
68+
Returns the a longer version of the provider name, which can include extra details
69+
such as version numbers. E.g. "Lastools LIDAR tools (version 2.2.1)".
6070
This string should be localised.
71+
72+
The default implementation returns the same string as name().
73+
74+
.. seealso:: name()
6175
.. seealso:: id()
6276
:rtype: str
6377
%End

python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def setActive(self, active):
124124
def name(self):
125125
return 'GDAL'
126126

127+
def longName(self):
128+
version = GdalUtils.readableVersion()
129+
return 'GDAL ({})'.format(version)
130+
127131
def id(self):
128132
return 'gdal'
129133

python/plugins/processing/gui/ProcessingToolbox.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ def activateProvider():
454454
self.algorithmTree.setItemWidget(parent, 0, label)
455455
else:
456456
parent.setText(0, text)
457-
parent.setToolTip(0, parent.text(0))
458457

459458
for groupItem in list(groups.values()):
460459
parent.addChild(groupItem)
@@ -512,6 +511,7 @@ def __init__(self, provider, tree, toolbox):
512511
self.provider = provider
513512
self.setIcon(0, self.provider.icon())
514513
self.setData(0, ProcessingToolbox.TYPE_ROLE, ProcessingToolbox.PROVIDER_ITEM)
514+
self.setToolTip(0, self.provider.longName())
515515
self.populate()
516516

517517
def refresh(self):

src/core/processing/qgsprocessingprovider.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ QString QgsProcessingProvider::svgIconPath() const
3939
return QgsApplication::iconPath( QStringLiteral( "processingAlgorithm.svg" ) );
4040
}
4141

42+
QString QgsProcessingProvider::longName() const
43+
{
44+
return name();
45+
}
46+
4247
void QgsProcessingProvider::refreshAlgorithms()
4348
{
4449
qDeleteAll( mAlgorithms );

src/core/processing/qgsprocessingprovider.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,25 @@ class CORE_EXPORT QgsProcessingProvider : public QObject
7070
virtual QString id() const = 0;
7171

7272
/**
73-
* Returns the full provider name, which is used to describe the provider within the GUI.
74-
* This string should be localised.
73+
* Returns the provider name, which is used to describe the provider within the GUI.
74+
* This string should be short (e.g. "Lastools") and localised.
75+
* \see longName()
7576
* \see id()
7677
*/
7778
virtual QString name() const = 0;
7879

80+
/**
81+
* Returns the a longer version of the provider name, which can include extra details
82+
* such as version numbers. E.g. "Lastools LIDAR tools (version 2.2.1)".
83+
* This string should be localised.
84+
*
85+
* The default implementation returns the same string as name().
86+
*
87+
* \see name()
88+
* \see id()
89+
*/
90+
virtual QString longName() const;
91+
7992
/**
8093
* Returns true if the provider can be activated, or false if it cannot be activated (e.g. due to
8194
* missing external dependencies).

0 commit comments

Comments
 (0)