more const correctness

This commit is contained in:
Denis Rouzaud 2014-09-01 16:45:54 +02:00
parent 5c5deec4a0
commit 665866f1a6
10 changed files with 29 additions and 29 deletions

View File

@ -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

View File

@ -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 );
@ -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

View File

@ -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 */

View File

@ -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();

View File

@ -46,7 +46,7 @@ void QgsFieldComboBox::setLayer( QgsVectorLayer *layer )
mFieldProxyModel->sourceFieldModel()->setLayer( layer );
}
QgsVectorLayer *QgsFieldComboBox::layer()
QgsVectorLayer *QgsFieldComboBox::layer() const
{
return mFieldProxyModel->sourceFieldModel()->layer();
}
@ -67,7 +67,7 @@ void QgsFieldComboBox::setField( QString fieldName )
setCurrentIndex( -1 );
}
QString QgsFieldComboBox::currentField()
QString QgsFieldComboBox::currentField() const
{
int i = currentIndex();

View File

@ -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

View File

@ -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 )
@ -114,7 +114,7 @@ QString QgsFieldExpressionWidget::currentField( bool *isExpression , bool *isVal
return text;
}
QgsVectorLayer *QgsFieldExpressionWidget::layer()
QgsVectorLayer *QgsFieldExpressionWidget::layer() const
{
return mFieldProxyModel->sourceFieldModel()->layer();
}

View File

@ -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 );
@ -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

View File

@ -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 */

View File

@ -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();