[locators] Add a description property to locator filter base class (#42132)

This commit is contained in:
Mathieu Pellerin 2021-03-09 17:56:15 +07:00 committed by GitHub
parent c1da9b0806
commit 2008f5ef57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -138,6 +138,13 @@ Returns the unique name for the filter. This should be an untranslated string id
Returns a translated, user-friendly name for the filter. Returns a translated, user-friendly name for the filter.
.. seealso:: :py:func:`name` .. seealso:: :py:func:`name`
%End
virtual QString description() const;
%Docstring
Returns a translated, description for the filter.
.. versionadded:: 3.20
%End %End
virtual QgsLocatorFilter::Flags flags() const; virtual QgsLocatorFilter::Flags flags() const;

View File

@ -198,6 +198,12 @@ class CORE_EXPORT QgsLocatorFilter : public QObject
*/ */
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
/**
* Returns a translated, description for the filter.
* \since QGIS 3.20
*/
virtual QString description() const { return QString(); }
/** /**
* Returns flags which specify the filter's behavior. * Returns flags which specify the filter's behavior.
*/ */

View File

@ -47,6 +47,9 @@ class test_filter(QgsLocatorFilter):
def displayName(self): def displayName(self):
return 'test_' + self.identifier return 'test_' + self.identifier
def description(self):
return 'test_description'
def prefix(self): def prefix(self):
return self._prefix return self._prefix