Skip to content
Permalink
Browse files

more const correctness

  • Loading branch information
3nids committed Sep 1, 2014
1 parent 5c5deec commit 665866f1a65b89e3d3fb2c0f47fcd56236928d19
@@ -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
@@ -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
@@ -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 */
@@ -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();
@@ -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();

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

0 comments on commit 665866f

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