fix build error and update sips

This commit is contained in:
Juergen E. Fischer 2014-06-14 11:47:05 +02:00
parent 5d70839f11
commit 03475be523
6 changed files with 24 additions and 6 deletions

View File

@ -66,6 +66,8 @@ class QgsExpression
//! @note added in 2.2 //! @note added in 2.2
static bool hasSpecialColumn( const QString& name ); static bool hasSpecialColumn( const QString& name );
static bool isValid( const QString& text, const QgsFields& fields, QString &errorMessage );
void setScale( double scale ); void setScale( double scale );
double scale(); double scale();

View File

@ -20,6 +20,8 @@ class QgsFieldExpressionWidget : QWidget
//! setFilters allows fitering according to the type of field //! setFilters allows fitering according to the type of field
void setFilters( QgsFieldProxyModel::Filters filters ); void setFilters( QgsFieldProxyModel::Filters filters );
void setLeftHandButtonStyle( bool isLeft );
//! currently used filter on list of fields //! currently used filter on list of fields
QgsFieldProxyModel::Filters filters(); QgsFieldProxyModel::Filters filters();
@ -33,6 +35,17 @@ class QgsFieldExpressionWidget : QWidget
*/ */
QString currentField( bool *isExpression = 0, bool *isValid = 0 ); 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 //! Returns the currently used layer
QgsVectorLayer* layer(); QgsVectorLayer* layer();
@ -43,6 +56,8 @@ class QgsFieldExpressionWidget : QWidget
//! fieldChanged signal with indication of the validity of the expression //! fieldChanged signal with indication of the validity of the expression
void fieldChanged( QString fieldName, bool isValid ); void fieldChanged( QString fieldName, bool isValid );
void returnPressed();
public slots: public slots:
//! set the layer used to display the fields and expression //! set the layer used to display the fields and expression
void setLayer( QgsVectorLayer* layer ); void setLayer( QgsVectorLayer* layer );

View File

@ -1729,7 +1729,7 @@ bool QgsExpression::hasSpecialColumn( const QString& name )
return gmSpecialColumns.contains( 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 ); QgsExpression exp( text );
exp.prepare( fields ); exp.prepare( fields );

View File

@ -152,7 +152,7 @@ class CORE_EXPORT QgsExpression
//! @note added in 2.2 //! @note added in 2.2
static bool hasSpecialColumn( const QString& name ); 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; } void setScale( double scale ) { mScale = scale; }

View File

@ -87,9 +87,10 @@ QString QgsFieldExpressionWidget::currentText()
return mCombo->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() bool QgsFieldExpressionWidget::isExpression()

View File

@ -77,11 +77,11 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
/** /**
* Return true if the current expression is valid * Return true if the current expression is valid
*/ */
bool isValidExpression( QString& expressionError = QString() ); bool isValidExpression( QString *expressionError = 0 );
bool isExpression(); 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(); QString currentText();