Skip to content

Commit

Permalink
Fix test failure, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 16, 2018
1 parent 8b77d9e commit 80159c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/gui/processing/qgsprocessingtoolboxmodel.cpp
Expand Up @@ -75,19 +75,15 @@ void QgsProcessingToolboxModelNode::deleteChildren()
//

QgsProcessingToolboxModelProviderNode::QgsProcessingToolboxModelProviderNode( QgsProcessingProvider *provider )
: mProvider( provider )
: mProviderId( provider->id() )
, mProvider( provider )
{}

QgsProcessingProvider *QgsProcessingToolboxModelProviderNode::provider()
{
return mProvider;
}

QString QgsProcessingToolboxModelProviderNode::providerId() const
{
return mProvider ? mProvider->id() : QString();
}

//
// QgsProcessingToolboxModelGroupNode
//
Expand Down
10 changes: 8 additions & 2 deletions src/gui/processing/qgsprocessingtoolboxmodel.h
Expand Up @@ -175,11 +175,17 @@ class GUI_EXPORT QgsProcessingToolboxModelProviderNode : public QgsProcessingToo
/**
* Returns the provider ID.
*/
QString providerId() const;
QString providerId() const { return mProviderId; }

private:

QgsProcessingProvider *mProvider = nullptr;
// NOTE: we store both the provider ID and a pointer to the provider here intentionally.
// We store the provider pointer to avoid having to lookup the provider from the registry
// everytime the node is used (which kills performance in the filter proxy model), but
// we also store the provider id string in order to identify the provider that the node
// is linked to for cleanups after the provider is removed.
QString mProviderId;
QPointer< QgsProcessingProvider > mProvider;

};

Expand Down

0 comments on commit 80159c2

Please sign in to comment.