Remove const_cast

This commit is contained in:
Nyall Dawson 2019-09-18 06:47:46 +10:00
parent 3de0593957
commit ffc71c4f57
10 changed files with 11 additions and 11 deletions

View File

@ -240,7 +240,7 @@ with the variables specified.
.. versionadded:: 3.0
%End
static QgsExpressionContextScope *atlasScope( QgsLayoutAtlas *atlas ) /Factory/;
static QgsExpressionContextScope *atlasScope( const QgsLayoutAtlas *atlas ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a :py:class:`QgsLayoutAtlas`.
For instance, current page name and number.

View File

@ -41,7 +41,7 @@ is available or required.
Ends the render, performing any required cleanup tasks.
%End
virtual int count() = 0;
virtual int count() const = 0;
%Docstring
Returns the number of features to iterate over.
%End

View File

@ -105,7 +105,7 @@ Returns the parent report section.
Returns the associated project.
%End
virtual int count();
virtual int count() const;
virtual QString filePath( const QString &baseFilePath, const QString &extension );

View File

@ -267,7 +267,7 @@ number of matching features.
virtual bool endRender();
virtual int count();
virtual int count() const;
virtual QString filePath( const QString &baseFilePath, const QString &extension );

View File

@ -514,7 +514,7 @@ void QgsExpressionContextUtils::setLayoutVariables( QgsLayout *layout, const QVa
layout->setCustomProperty( QStringLiteral( "variableValues" ), variableValues );
}
QgsExpressionContextScope *QgsExpressionContextUtils::atlasScope( QgsLayoutAtlas *atlas )
QgsExpressionContextScope *QgsExpressionContextUtils::atlasScope( const QgsLayoutAtlas *atlas )
{
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Atlas" ) );
if ( !atlas )

View File

@ -222,7 +222,7 @@ class CORE_EXPORT QgsExpressionContextUtils
* For instance, current page name and number.
* \param atlas source atlas. If NULLPTR, a set of default atlas variables will be added to the scope.
*/
static QgsExpressionContextScope *atlasScope( QgsLayoutAtlas *atlas ) SIP_FACTORY;
static QgsExpressionContextScope *atlasScope( const QgsLayoutAtlas *atlas ) SIP_FACTORY;
/**
* Creates a new scope which contains variables and functions relating to a QgsLayoutItem.

View File

@ -54,7 +54,7 @@ class CORE_EXPORT QgsAbstractLayoutIterator
/**
* Returns the number of features to iterate over.
*/
virtual int count() = 0;
virtual int count() const = 0;
/**
* Iterates to next feature, returning FALSE if no more features exist to iterate over.

View File

@ -121,7 +121,7 @@ class CORE_EXPORT QgsAbstractReportSection : public QgsAbstractLayoutIterator
QgsProject *project();
// TODO - how to handle this?
int count() override { return -1; }
int count() const override { return -1; }
QString filePath( const QString &baseFilePath, const QString &extension ) override;
QgsLayout *layout() override;

View File

@ -340,7 +340,7 @@ bool QgsLayoutAtlas::endRender()
return true;
}
int QgsLayoutAtlas::count()
int QgsLayoutAtlas::count() const
{
return mFeatureIds.size();
}
@ -447,7 +447,7 @@ QgsExpressionContext QgsLayoutAtlas::createExpressionContext() const
expressionContext << QgsExpressionContextUtils::projectScope( mLayout->project() )
<< QgsExpressionContextUtils::layoutScope( mLayout );
expressionContext.appendScope( QgsExpressionContextUtils::atlasScope( const_cast< QgsLayoutAtlas * >( this ) ) );
expressionContext.appendScope( QgsExpressionContextUtils::atlasScope( this ) );
if ( mCoverageLayer )
expressionContext.appendScope( mCoverageLayer->createExpressionContextScope() );

View File

@ -245,7 +245,7 @@ class CORE_EXPORT QgsLayoutAtlas : public QObject, public QgsAbstractLayoutItera
bool beginRender() override;
bool endRender() override;
int count() override;
int count() const override;
QString filePath( const QString &baseFilePath, const QString &extension ) override;
/**