Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dox
  • Loading branch information
nyalldawson committed Jul 16, 2018
1 parent 8caecbb commit 45d856e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Expand Up @@ -47,7 +47,7 @@ level group containing recently used algorithms.
%Docstring
Sets the processing ``registry`` associated with the view.

If \recentLog is specified then it will be used to create a "Recently used" top
If ``recentLog`` is specified then it will be used to create a "Recently used" top
level group containing recently used algorithms.
%End

Expand Down
18 changes: 15 additions & 3 deletions src/gui/processing/qgsprocessingtoolboxmodel.cpp
Expand Up @@ -138,10 +138,13 @@ void QgsProcessingToolboxModel::rebuild()
repopulateRecentAlgorithms( true );
}

const QList< QgsProcessingProvider * > providers = mRegistry->providers();
for ( QgsProcessingProvider *provider : providers )
if ( mRegistry )
{
addProvider( provider );
const QList< QgsProcessingProvider * > providers = mRegistry->providers();
for ( QgsProcessingProvider *provider : providers )
{
addProvider( provider );
}
}
endResetModel();
}
Expand All @@ -160,6 +163,12 @@ void QgsProcessingToolboxModel::repopulateRecentAlgorithms( bool resetting )
endRemoveRows();
}

if ( !mRegistry )
{
emit recentAlgorithmAdded();
return;
}

const QStringList recentAlgIds = mRecentLog->recentAlgorithmIds();
QList< const QgsProcessingAlgorithm * > recentAlgorithms;
recentAlgorithms.reserve( recentAlgIds.count() );
Expand Down Expand Up @@ -196,6 +205,9 @@ void QgsProcessingToolboxModel::repopulateRecentAlgorithms( bool resetting )

void QgsProcessingToolboxModel::providerAdded( const QString &id )
{
if ( !mRegistry )
return;

QgsProcessingProvider *provider = mRegistry->providerById( id );
if ( !provider )
return;
Expand Down
5 changes: 3 additions & 2 deletions src/gui/processing/qgsprocessingtoolboxmodel.h
Expand Up @@ -20,6 +20,7 @@
#include "qgis_gui.h"
#include <QAbstractItemModel>
#include <QSortFilterProxyModel>
#include <QPointer>

class QgsProcessingRegistry;
class QgsProcessingProvider;
Expand Down Expand Up @@ -375,8 +376,8 @@ class GUI_EXPORT QgsProcessingToolboxModel : public QAbstractItemModel

private:

QgsProcessingRegistry *mRegistry = nullptr;
QgsProcessingRecentAlgorithmLog *mRecentLog = nullptr;
QPointer< QgsProcessingRegistry > mRegistry;
QPointer< QgsProcessingRecentAlgorithmLog > mRecentLog;

std::unique_ptr< QgsProcessingToolboxModelGroupNode > mRootNode;
QgsProcessingToolboxModelRecentNode *mRecentNode = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingtoolboxtreeview.h
Expand Up @@ -56,7 +56,7 @@ class GUI_EXPORT QgsProcessingToolboxTreeView : public QTreeView
/**
* Sets the processing \a registry associated with the view.
*
* If \recentLog is specified then it will be used to create a "Recently used" top
* If \a recentLog is specified then it will be used to create a "Recently used" top
* level group containing recently used algorithms.
*/
void setRegistry(
Expand Down

0 comments on commit 45d856e

Please sign in to comment.