Skip to content
Permalink
Browse files

allow to reset prefixes in settings

  • Loading branch information
3nids committed May 10, 2018
1 parent 0a0de2e commit 6459d24e5ad4dedd531b26c6516db2efd05d3bfd
@@ -73,23 +73,13 @@ deregisterFilter() to deregister their filters upon plugin unload to avoid crash
.. seealso:: :py:func:`registerFilter`
%End

QList< QgsLocatorFilter *> filters( const QString &prefix = QString() );
QList< QgsLocatorFilter *> filters();
%Docstring
Returns the list of filters registered in the locator.

.. seealso:: :py:func:`prefixedFilters`
%End

QStringList prefixes();
%Docstring
Returns the list of prefixes in use.
A prefix can have several filters

.. seealso:: :py:func:`filter`

.. versionadded:: 3.2
%End


QMap<QString, QgsLocatorFilter *> prefixedFilters() const;
%Docstring
@@ -178,9 +178,15 @@ bool QgsLocatorFiltersModel::setData( const QModelIndex &index, const QVariant &
case Prefix:
{
QString prefix = value.toString();
if ( prefix.isEmpty() )
return false;
mPrefixes.insert( filterForIndex( index ), prefix );
if ( !prefix.isEmpty() )
{
mPrefixes.insert( filterForIndex( index ), prefix );
}
else
{
// reset to the native prefix
mPrefixes.insert( filterForIndex( index ), filterForIndex( index )->prefix() );
}
emit dataChanged( index, index );
return true;
}
@@ -48,17 +48,9 @@ void QgsLocator::deregisterFilter( QgsLocatorFilter *filter )
delete filter;
}

QList<QgsLocatorFilter *> QgsLocator::filters( const QString &prefix )
QList<QgsLocatorFilter *> QgsLocator::filters()
{
if ( !prefix.isEmpty() )
return mPrefixedFilters.values( prefix );
else
return mFilters;
}

QStringList QgsLocator::prefixes()
{
return mPrefixedFilters.keys();
return mFilters;
}

QMultiMap<QString, QgsLocatorFilter *> QgsLocator::prefixedFilters() const
@@ -60,6 +60,7 @@ class CORE_EXPORT QgsLocator : public QObject

public:

//! List of core filters (i.e. not plugin filters)
static const QList<QString> CORE_FILTERS;

/**
@@ -96,15 +97,7 @@ class CORE_EXPORT QgsLocator : public QObject
* Returns the list of filters registered in the locator.
* \see prefixedFilters()
*/
QList< QgsLocatorFilter *> filters( const QString &prefix = QString() );

/**
* Returns the list of prefixes in use.
* A prefix can have several filters
* \see filter()
* \since QGIS 3.2
*/
QStringList prefixes();
QList< QgsLocatorFilter *> filters();

#ifndef SIP_RUN

0 comments on commit 6459d24

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