Skip to content

Commit

Permalink
more const correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Sep 1, 2014
1 parent 5c5deec commit 665866f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions python/gui/qgsfieldcombobox.sip
Expand Up @@ -23,13 +23,13 @@ class QgsFieldComboBox : QComboBox
void setFilters( QgsFieldProxyModel::Filters filters );

//! currently used filter on list of fields
QgsFieldProxyModel::Filters filters();
QgsFieldProxyModel::Filters filters() const;

//! return the currently selected field
QString currentField();
QString currentField() const;

//! Returns the currently used layer
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

signals:
//! the signal is emitted when the currently selected field changes
Expand Down
12 changes: 6 additions & 6 deletions python/gui/qgsfieldexpressionwidget.sip
Expand Up @@ -23,7 +23,7 @@ class QgsFieldExpressionWidget : QWidget
void setLeftHandButtonStyle( bool isLeft );

//! currently used filter on list of fields
QgsFieldProxyModel::Filters filters();
QgsFieldProxyModel::Filters filters() const;

//! set the geometry calculator used in the expression dialog
void setGeomCalculator( const QgsDistanceArea &da );
Expand All @@ -33,21 +33,21 @@ class QgsFieldExpressionWidget : QWidget
* @param isExpression determines if the string returned is the name of a field or an expression
* @param isValid determines if the expression (or field) returned is valid
*/
QString currentField( bool *isExpression = 0, bool *isValid = 0 );
QString currentField( bool *isExpression = 0, bool *isValid = 0 ) const;

/**
* Return true if the current expression is valid
*/
bool isValidExpression( QString *expressionError = 0 );
bool isValidExpression( QString *expressionError = 0 ) const;

bool isExpression();
bool isExpression() const;
/**
* Return the current text that is set in the expression area
*/
QString currentText();
QString currentText() const;

//! Returns the currently used layer
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

signals:
//! the signal is emitted when the currently selected field changes
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsmaplayeractionregistry.sip
Expand Up @@ -34,7 +34,7 @@ class QgsMapLayerAction : QAction

/** Define the targets of the action */
void setTargets( Targets targets );
Targets targets() const;
const Targets& targets() const;

signals:
/** Triggered when action has been run for a specific feature */
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsmaplayercombobox.sip
Expand Up @@ -20,7 +20,7 @@ class QgsMapLayerComboBox : QComboBox
void setFilters( QgsMapLayerProxyModel::Filters filters );

//! currently used filter on list layers
QgsMapLayerProxyModel::Filters filters();
QgsMapLayerProxyModel::Filters filters() const;

//! currentLayer returns the current layer selected in the combo box
QgsMapLayer* currentLayer();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsfieldcombobox.cpp
Expand Up @@ -46,7 +46,7 @@ void QgsFieldComboBox::setLayer( QgsVectorLayer *layer )
mFieldProxyModel->sourceFieldModel()->setLayer( layer );
}

QgsVectorLayer *QgsFieldComboBox::layer()
QgsVectorLayer *QgsFieldComboBox::layer() const
{
return mFieldProxyModel->sourceFieldModel()->layer();
}
Expand All @@ -67,7 +67,7 @@ void QgsFieldComboBox::setField( QString fieldName )
setCurrentIndex( -1 );
}

QString QgsFieldComboBox::currentField()
QString QgsFieldComboBox::currentField() const
{
int i = currentIndex();

Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsfieldcombobox.h
Expand Up @@ -47,13 +47,13 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
void setFilters( QgsFieldProxyModel::Filters filters );

//! currently used filter on list of fields
QgsFieldProxyModel::Filters filters() { return mFieldProxyModel->filters(); }
QgsFieldProxyModel::Filters filters() const { return mFieldProxyModel->filters(); }

//! return the currently selected field
QString currentField();
QString currentField() const;

//! Returns the currently used layer
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

signals:
//! the signal is emitted when the currently selected field changes
Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -83,24 +83,24 @@ void QgsFieldExpressionWidget::setGeomCalculator( const QgsDistanceArea &da )
mDa = QSharedPointer<const QgsDistanceArea>( new QgsDistanceArea( da ) );
}

QString QgsFieldExpressionWidget::currentText()
QString QgsFieldExpressionWidget::currentText() const
{
return mCombo->currentText();
}

bool QgsFieldExpressionWidget::isValidExpression( QString *expressionError )
bool QgsFieldExpressionWidget::isValidExpression( QString *expressionError ) const
{
QString temp;
QgsVectorLayer* vl = layer();
return QgsExpression::isValid( currentText(), vl ? vl->pendingFields() : QgsFields(), expressionError ? *expressionError : temp );
}

bool QgsFieldExpressionWidget::isExpression()
bool QgsFieldExpressionWidget::isExpression() const
{
return !mFieldProxyModel->sourceFieldModel()->isField( currentText() );
}

QString QgsFieldExpressionWidget::currentField( bool *isExpression , bool *isValid )
QString QgsFieldExpressionWidget::currentField( bool *isExpression , bool *isValid ) const
{
QString text = currentText();
if ( isValid )
Expand All @@ -114,7 +114,7 @@ QString QgsFieldExpressionWidget::currentField( bool *isExpression , bool *isVal
return text;
}

QgsVectorLayer *QgsFieldExpressionWidget::layer()
QgsVectorLayer *QgsFieldExpressionWidget::layer() const
{
return mFieldProxyModel->sourceFieldModel()->layer();
}
Expand Down
12 changes: 6 additions & 6 deletions src/gui/qgsfieldexpressionwidget.h
Expand Up @@ -62,7 +62,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
void setLeftHandButtonStyle( bool isLeft );

//! currently used filter on list of fields
QgsFieldProxyModel::Filters filters() { return mFieldProxyModel->filters(); }
QgsFieldProxyModel::Filters filters() const { return mFieldProxyModel->filters(); }

//! set the geometry calculator used in the expression dialog
void setGeomCalculator( const QgsDistanceArea &da );
Expand All @@ -72,21 +72,21 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
* @param isExpression determines if the string returned is the name of a field or an expression
* @param isValid determines if the expression (or field) returned is valid
*/
QString currentField( bool *isExpression = 0, bool *isValid = 0 );
QString currentField( bool *isExpression = 0, bool *isValid = 0 ) const;

/**
* Return true if the current expression is valid
*/
bool isValidExpression( QString *expressionError = 0 );
bool isValidExpression( QString *expressionError = 0 ) const;

bool isExpression();
bool isExpression() const;
/**
* Return the current text that is set in the expression area
*/
QString currentText();
QString currentText() const;

//! Returns the currently used layer
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

signals:
//! the signal is emitted when the currently selected field changes
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaplayeractionregistry.h
Expand Up @@ -70,7 +70,7 @@ class GUI_EXPORT QgsMapLayerAction : public QAction
/** Define the targets of the action */
void setTargets( Targets targets ) {mTargets = targets;}
/** Return availibity of action */
Targets targets() const {return mTargets;}
const Targets& targets() const {return mTargets;}

signals:
/** Triggered when action has been run for a specific list of features */
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaplayercombobox.h
Expand Up @@ -44,7 +44,7 @@ class GUI_EXPORT QgsMapLayerComboBox : public QComboBox
void setFilters( QgsMapLayerProxyModel::Filters filters );

//! currently used filter on list layers
QgsMapLayerProxyModel::Filters filters() { return mProxyModel->filters(); }
QgsMapLayerProxyModel::Filters filters() const { return mProxyModel->filters(); }

//! currentLayer returns the current layer selected in the combo box
QgsMapLayer* currentLayer();
Expand Down

0 comments on commit 665866f

Please sign in to comment.