File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ void QgsFieldExpressionWidget::indexChanged( int i )
147
147
Q_UNUSED ( i );
148
148
bool isExpression;
149
149
QString fieldName = currentField ( &isExpression );
150
+ bool isValid = true ;
150
151
151
152
QFont font = mCombo ->lineEdit ()->font ();
152
153
font.setItalic ( isExpression );
@@ -159,7 +160,7 @@ void QgsFieldExpressionWidget::indexChanged( int i )
159
160
QModelIndex idx = mFieldModel ->indexFromName ( fieldName );
160
161
if ( idx.isValid () )
161
162
{
162
- bool isValid = mFieldModel ->data ( idx, QgsFieldModel::ExpressionValidityRole ).toBool ();
163
+ isValid = mFieldModel ->data ( idx, QgsFieldModel::ExpressionValidityRole ).toBool ();
163
164
if ( !isValid )
164
165
{
165
166
palette.setColor ( QPalette::Text, Qt::red );
@@ -169,4 +170,5 @@ void QgsFieldExpressionWidget::indexChanged( int i )
169
170
mCombo ->lineEdit ()->setPalette ( palette );
170
171
171
172
emit fieldChanged ( fieldName );
173
+ emit fieldChanged ( fieldName, isValid );
172
174
}
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
57
57
// ! the signal is emitted when the currently selected field changes
58
58
void fieldChanged ( QString fieldName );
59
59
60
+ // ! fieldChanged signal with indication of the validity of the expression
61
+ void fieldChanged ( QString fieldName, bool isValid );
62
+
60
63
public slots:
61
64
// ! set the layer used to display the fields and expression
62
65
void setLayer ( QgsVectorLayer* layer );
You can’t perform that action at this time.
0 commit comments