Review fixes

This commit is contained in:
Nyall Dawson 2018-07-16 10:27:26 +10:00
parent 8f2c01d657
commit 8b77d9e1e5
4 changed files with 30 additions and 24 deletions

View File

@ -2,7 +2,7 @@
qgsreportsectionmodel.cpp
---------------------
begin : December 2017
copyright : (C) 2017 by Nyall Dawso
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *

View File

@ -1,5 +1,5 @@
/***************************************************************************
QgsProcessingToolboxModel.cpp
qgsprocessingtoolboxmodel.cpp
-------------------------------
begin : May 2018
copyright : (C) 2018 by Nyall Dawson
@ -75,8 +75,7 @@ void QgsProcessingToolboxModelNode::deleteChildren()
//
QgsProcessingToolboxModelProviderNode::QgsProcessingToolboxModelProviderNode( QgsProcessingProvider *provider )
: mProviderId( provider->id() )
, mProvider( provider )
: mProvider( provider )
{}
QgsProcessingProvider *QgsProcessingToolboxModelProviderNode::provider()
@ -84,6 +83,11 @@ QgsProcessingProvider *QgsProcessingToolboxModelProviderNode::provider()
return mProvider;
}
QString QgsProcessingToolboxModelProviderNode::providerId() const
{
return mProvider ? mProvider->id() : QString();
}
//
// QgsProcessingToolboxModelGroupNode
//
@ -227,8 +231,8 @@ void QgsProcessingToolboxModel::providerAdded( const QString &id )
}
else
{
//native providers use top level groups - that's too hard for us to
//work out exactly what's going to change, so just reset the model
// native providers use top level groups - that's too hard for us to
// work out exactly what's going to change, so just reset the model
beginResetModel();
addProvider( provider );
endResetModel();
@ -283,6 +287,9 @@ QModelIndex QgsProcessingToolboxModel::node2index( QgsProcessingToolboxModelNode
void QgsProcessingToolboxModel::addProvider( QgsProcessingProvider *provider )
{
if ( !provider )
return;
connect( provider, &QgsProcessingProvider::algorithmsLoaded, this, &QgsProcessingToolboxModel::rebuild, Qt::UniqueConnection );
QgsProcessingToolboxModelNode *parentNode = nullptr;

View File

@ -1,6 +1,6 @@
/***************************************************************************
qgsprocessingalgorithmmodel.h
-----------------------------
qgsprocessingtoolboxmodel.h
---------------------------
begin : May 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
@ -13,8 +13,8 @@
* *
***************************************************************************/
#ifndef QGSPROCESSINGALGORITHMMODEL_H
#define QGSPROCESSINGALGORITHMMODEL_H
#ifndef QGSPROCESSINGTOOLBOXMODEL_H
#define QGSPROCESSINGTOOLBOXMODEL_H
#include "qgis.h"
#include "qgis_gui.h"
@ -31,7 +31,7 @@ class QgsProcessingRecentAlgorithmLog;
///@cond PRIVATE
/**
* Abstract base class for nodes contained within a QgsProcessingToolboxModel.
* \brief Abstract base class for nodes contained within a QgsProcessingToolboxModel.
* \warning Not part of stable API and may change in future QGIS releases.
* \ingroup gui
* \since QGIS 3.4
@ -127,7 +127,7 @@ class GUI_EXPORT QgsProcessingToolboxModelNode : public QObject
};
/**
* Processing toolbox model node corresponding to the recent algorithms group
* \brief Processing toolbox model node corresponding to the recent algorithms group
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
@ -148,7 +148,7 @@ class GUI_EXPORT QgsProcessingToolboxModelRecentNode : public QgsProcessingToolb
};
/**
* Processing toolbox model node corresponding to a Processing provider.
* \brief Processing toolbox model node corresponding to a Processing provider.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
@ -175,17 +175,16 @@ class GUI_EXPORT QgsProcessingToolboxModelProviderNode : public QgsProcessingToo
/**
* Returns the provider ID.
*/
QString providerId() const { return mProviderId; }
QString providerId() const;
private:
QString mProviderId;
QgsProcessingProvider *mProvider = nullptr;
};
/**
* Processing toolbox model node corresponding to a group of algorithms.
* \brief Processing toolbox model node corresponding to a group of algorithms.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
@ -224,7 +223,7 @@ class GUI_EXPORT QgsProcessingToolboxModelGroupNode : public QgsProcessingToolbo
};
/**
* Processing toolbox model node corresponding to an algorithm.
* \brief Processing toolbox model node corresponding to an algorithm.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
@ -257,7 +256,7 @@ class GUI_EXPORT QgsProcessingToolboxModelAlgorithmNode : public QgsProcessingTo
///@endcond
/**
* A model for providers and algorithms shown within the Processing toolbox.
* \brief A model for providers and algorithms shown within the Processing toolbox.
*
* See QgsProcessingToolboxProxyModel for a sorted, filterable version
* of this model.
@ -400,7 +399,7 @@ class GUI_EXPORT QgsProcessingToolboxModel : public QAbstractItemModel
/**
* A sort/filter proxy model for providers and algorithms shown within the Processing toolbox,
* \brief A sort/filter proxy model for providers and algorithms shown within the Processing toolbox,
* which automatically sorts the toolbox in a logical fashion and supports filtering
* the results.
*
@ -483,4 +482,4 @@ class GUI_EXPORT QgsProcessingToolboxProxyModel: public QSortFilterProxyModel
};
#endif // QGSPROCESSINGALGORITHMMODEL_H
#endif // QGSPROCESSINGTOOLBOXMODEL_H

View File

@ -1,8 +1,8 @@
/***************************************************************************
testqgsprocessing.cpp
---------------------
begin : January 2017
copyright : (C) 2017 by Nyall Dawson
testqgsprocessingmodel.cpp
--------------------------
begin : July 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/