Skip to content

Commit 778fb62

Browse files
committedMay 2, 2014
add signal with expression validity
1 parent d828f6b commit 778fb62

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎src/gui/qgsfieldexpressionwidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ void QgsFieldExpressionWidget::indexChanged( int i )
147147
Q_UNUSED( i );
148148
bool isExpression;
149149
QString fieldName = currentField( &isExpression );
150+
bool isValid = true;
150151

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

171172
emit fieldChanged( fieldName );
173+
emit fieldChanged( fieldName, isValid );
172174
}

‎src/gui/qgsfieldexpressionwidget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
5757
//! the signal is emitted when the currently selected field changes
5858
void fieldChanged( QString fieldName );
5959

60+
//! fieldChanged signal with indication of the validity of the expression
61+
void fieldChanged( QString fieldName, bool isValid );
62+
6063
public slots:
6164
//! set the layer used to display the fields and expression
6265
void setLayer( QgsVectorLayer* layer );

0 commit comments

Comments
 (0)
Please sign in to comment.