Skip to content
Permalink
Browse files

Protect the const-ituional correctness

  • Loading branch information
m-kuhn committed Apr 10, 2018
1 parent 02da420 commit ffb2817afb67e6e147c910e94ab88b61985e150c
@@ -58,12 +58,12 @@ Interface base class for factories for algorithm configuration widgets.
public:
virtual ~QgsProcessingAlgorithmConfigurationWidgetFactory();

virtual QgsProcessingAlgorithmConfigurationWidget *create( QgsProcessingAlgorithm *algorithm ) const = 0 /Factory/;
virtual QgsProcessingAlgorithmConfigurationWidget *create( const QgsProcessingAlgorithm *algorithm ) const = 0 /Factory/;
%Docstring
Create a new configuration widget for ``algorithm``.
%End

virtual bool canCreateFor( QgsProcessingAlgorithm *algorithm ) const = 0;
virtual bool canCreateFor( const QgsProcessingAlgorithm *algorithm ) const = 0;
%Docstring
Check if this factory can create widgets for ``algorithm``.
%End
@@ -48,7 +48,7 @@ widgets.
.. versionadded:: 3.2
%End

QgsProcessingAlgorithmConfigurationWidget *algorithmConfigurationWidget( QgsProcessingAlgorithm *algorithm ) const;
QgsProcessingAlgorithmConfigurationWidget *algorithmConfigurationWidget( const QgsProcessingAlgorithm *algorithm ) const;
%Docstring
Get the configuration widget for an ``algorithm``. This widget will be shown
next to parameter widgets. Most algorithms do not have a configuration widget
@@ -73,12 +73,12 @@ class CORE_EXPORT QgsProcessingAlgorithmConfigurationWidgetFactory
/**
* Create a new configuration widget for \a algorithm.
*/
virtual QgsProcessingAlgorithmConfigurationWidget *create( QgsProcessingAlgorithm *algorithm ) const = 0 SIP_FACTORY;
virtual QgsProcessingAlgorithmConfigurationWidget *create( const QgsProcessingAlgorithm *algorithm ) const = 0 SIP_FACTORY;

/**
* Check if this factory can create widgets for \a algorithm.
*/
virtual bool canCreateFor( QgsProcessingAlgorithm *algorithm ) const = 0;
virtual bool canCreateFor( const QgsProcessingAlgorithm *algorithm ) const = 0;
};


@@ -148,15 +148,15 @@ void QgsFilterAlgorithmConfigurationWidget::addOutput()
mOutputExpressionWidget->setCellWidget( rowIndex, 2, new QCheckBox() );
}

QgsProcessingAlgorithmConfigurationWidget *QgsFilterAlgorithmConfigurationWidgetFactory::create( QgsProcessingAlgorithm *algorithm ) const
QgsProcessingAlgorithmConfigurationWidget *QgsFilterAlgorithmConfigurationWidgetFactory::create( const QgsProcessingAlgorithm *algorithm ) const
{
if ( algorithm->name() == QStringLiteral( "filter" ) )
return new QgsFilterAlgorithmConfigurationWidget();
else
return nullptr;
}

bool QgsFilterAlgorithmConfigurationWidgetFactory::canCreateFor( QgsProcessingAlgorithm *algorithm ) const
bool QgsFilterAlgorithmConfigurationWidgetFactory::canCreateFor( const QgsProcessingAlgorithm *algorithm ) const
{
if ( algorithm->name() == QStringLiteral( "filter" ) )
return true;
@@ -50,8 +50,8 @@ class QgsFilterAlgorithmConfigurationWidget : public QgsProcessingAlgorithmConfi
class QgsFilterAlgorithmConfigurationWidgetFactory : public QgsProcessingAlgorithmConfigurationWidgetFactory
{
public:
virtual QgsProcessingAlgorithmConfigurationWidget *create( QgsProcessingAlgorithm *algorithm ) const override;
virtual bool canCreateFor( QgsProcessingAlgorithm *algorithm ) const override;
virtual QgsProcessingAlgorithmConfigurationWidget *create( const QgsProcessingAlgorithm *algorithm ) const override;
virtual bool canCreateFor( const QgsProcessingAlgorithm *algorithm ) const override;
};

///@endcond
@@ -42,7 +42,7 @@ void QgsProcessingGuiRegistry::removeAlgorithmConfigurationWidgetFactory( QgsPro
delete factory;
}

QgsProcessingAlgorithmConfigurationWidget *QgsProcessingGuiRegistry::algorithmConfigurationWidget( QgsProcessingAlgorithm *algorithm ) const
QgsProcessingAlgorithmConfigurationWidget *QgsProcessingGuiRegistry::algorithmConfigurationWidget( const QgsProcessingAlgorithm *algorithm ) const
{
for ( const auto *factory : mAlgorithmConfigurationWidgetFactories )
{
@@ -68,7 +68,7 @@ class GUI_EXPORT QgsProcessingGuiRegistry
*
* \since QGIS 3.2
*/
QgsProcessingAlgorithmConfigurationWidget *algorithmConfigurationWidget( QgsProcessingAlgorithm *algorithm ) const;
QgsProcessingAlgorithmConfigurationWidget *algorithmConfigurationWidget( const QgsProcessingAlgorithm *algorithm ) const;

private:

0 comments on commit ffb2817

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