File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments