Skip to content
Permalink
Browse files

add signal with expression validity

  • Loading branch information
3nids committed May 2, 2014
1 parent d828f6b commit 778fb622b9a9467b7cb00d002a7fa244840954ed
Showing with 6 additions and 1 deletion.
  1. +3 −1 src/gui/qgsfieldexpressionwidget.cpp
  2. +3 −0 src/gui/qgsfieldexpressionwidget.h
@@ -147,6 +147,7 @@ void QgsFieldExpressionWidget::indexChanged( int i )
Q_UNUSED( i );
bool isExpression;
QString fieldName = currentField( &isExpression );
bool isValid = true;

QFont font = mCombo->lineEdit()->font();
font.setItalic( isExpression );
@@ -159,7 +160,7 @@ void QgsFieldExpressionWidget::indexChanged( int i )
QModelIndex idx = mFieldModel->indexFromName( fieldName );
if ( idx.isValid() )
{
bool isValid = mFieldModel->data( idx, QgsFieldModel::ExpressionValidityRole ).toBool();
isValid = mFieldModel->data( idx, QgsFieldModel::ExpressionValidityRole ).toBool();
if ( !isValid )
{
palette.setColor( QPalette::Text, Qt::red );
@@ -169,4 +170,5 @@ void QgsFieldExpressionWidget::indexChanged( int i )
mCombo->lineEdit()->setPalette( palette );

emit fieldChanged( fieldName );
emit fieldChanged( fieldName, isValid );
}
@@ -57,6 +57,9 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
//! the signal is emitted when the currently selected field changes
void fieldChanged( QString fieldName );

//! fieldChanged signal with indication of the validity of the expression
void fieldChanged( QString fieldName, bool isValid );

public slots:
//! set the layer used to display the fields and expression
void setLayer( QgsVectorLayer* layer );

0 comments on commit 778fb62

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