From 03475be5236fcf522ee9b1d96450b8c3ebbf7a2e Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Sat, 14 Jun 2014 11:47:05 +0200 Subject: [PATCH] fix build error and update sips --- python/core/qgsexpression.sip | 2 ++ python/gui/qgsfieldexpressionwidget.sip | 15 +++++++++++++++ src/core/qgsexpression.cpp | 2 +- src/core/qgsexpression.h | 2 +- src/gui/qgsfieldexpressionwidget.cpp | 5 +++-- src/gui/qgsfieldexpressionwidget.h | 4 ++-- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/python/core/qgsexpression.sip b/python/core/qgsexpression.sip index 4c5ac84774f..a232b997b67 100644 --- a/python/core/qgsexpression.sip +++ b/python/core/qgsexpression.sip @@ -66,6 +66,8 @@ class QgsExpression //! @note added in 2.2 static bool hasSpecialColumn( const QString& name ); + static bool isValid( const QString& text, const QgsFields& fields, QString &errorMessage ); + void setScale( double scale ); double scale(); diff --git a/python/gui/qgsfieldexpressionwidget.sip b/python/gui/qgsfieldexpressionwidget.sip index d3134444a1b..010e3b6ce7d 100644 --- a/python/gui/qgsfieldexpressionwidget.sip +++ b/python/gui/qgsfieldexpressionwidget.sip @@ -20,6 +20,8 @@ class QgsFieldExpressionWidget : QWidget //! setFilters allows fitering according to the type of field void setFilters( QgsFieldProxyModel::Filters filters ); + void setLeftHandButtonStyle( bool isLeft ); + //! currently used filter on list of fields QgsFieldProxyModel::Filters filters(); @@ -33,6 +35,17 @@ class QgsFieldExpressionWidget : QWidget */ QString currentField( bool *isExpression = 0, bool *isValid = 0 ); + /** + * Return true if the current expression is valid + */ + bool isValidExpression( QString *expressionError = 0 ); + + bool isExpression(); + /** + * Return the current text that is set in the expression area + */ + QString currentText(); + //! Returns the currently used layer QgsVectorLayer* layer(); @@ -43,6 +56,8 @@ class QgsFieldExpressionWidget : QWidget //! fieldChanged signal with indication of the validity of the expression void fieldChanged( QString fieldName, bool isValid ); + void returnPressed(); + public slots: //! set the layer used to display the fields and expression void setLayer( QgsVectorLayer* layer ); diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp index 9ef2f7d0910..e0276468bbb 100644 --- a/src/core/qgsexpression.cpp +++ b/src/core/qgsexpression.cpp @@ -1729,7 +1729,7 @@ bool QgsExpression::hasSpecialColumn( const QString& name ) return gmSpecialColumns.contains( name ); } -bool QgsExpression::isValid( const QString &text, const QgsFields &fields, QString errorMessage ) +bool QgsExpression::isValid( const QString &text, const QgsFields &fields, QString &errorMessage ) { QgsExpression exp( text ); exp.prepare( fields ); diff --git a/src/core/qgsexpression.h b/src/core/qgsexpression.h index b8d95338eff..291a0941add 100644 --- a/src/core/qgsexpression.h +++ b/src/core/qgsexpression.h @@ -152,7 +152,7 @@ class CORE_EXPORT QgsExpression //! @note added in 2.2 static bool hasSpecialColumn( const QString& name ); - static bool isValid( const QString& text, const QgsFields& fields, QString errorMessage ); + static bool isValid( const QString& text, const QgsFields& fields, QString &errorMessage ); void setScale( double scale ) { mScale = scale; } diff --git a/src/gui/qgsfieldexpressionwidget.cpp b/src/gui/qgsfieldexpressionwidget.cpp index ddbfcca889a..5c69dd4ab6f 100644 --- a/src/gui/qgsfieldexpressionwidget.cpp +++ b/src/gui/qgsfieldexpressionwidget.cpp @@ -87,9 +87,10 @@ QString QgsFieldExpressionWidget::currentText() return mCombo->currentText(); } -bool QgsFieldExpressionWidget::isValidExpression( QString& expressionError ) +bool QgsFieldExpressionWidget::isValidExpression( QString *expressionError ) { - return QgsExpression::isValid( currentText(), layer()->pendingFields(), expressionError ); + QString temp; + return QgsExpression::isValid( currentText(), layer()->pendingFields(), expressionError ? *expressionError : temp ); } bool QgsFieldExpressionWidget::isExpression() diff --git a/src/gui/qgsfieldexpressionwidget.h b/src/gui/qgsfieldexpressionwidget.h index 36279651326..6faaeb984ab 100644 --- a/src/gui/qgsfieldexpressionwidget.h +++ b/src/gui/qgsfieldexpressionwidget.h @@ -77,11 +77,11 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget /** * Return true if the current expression is valid */ - bool isValidExpression( QString& expressionError = QString() ); + bool isValidExpression( QString *expressionError = 0 ); bool isExpression(); /** - * Retun the current text that is set in the expression area + * Return the current text that is set in the expression area */ QString currentText();