File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,20 @@ void QgsRelationReferenceWidget::setForeignKey( const QVariant& value )
276
276
}
277
277
else
278
278
{
279
+ QString nullValue = QSettings ().value ( " qgis/nullValue" , " NULL" ).toString ();
280
+
281
+ if ( mChainFilters && mFeature .isValid () && mFilterComboBoxes .count () >= mFilterFields .count () )
282
+ {
283
+ QgsFeature feature = mFeature ;
284
+
285
+ for ( int i = 0 ; i < mFilterFields .size (); i++ )
286
+ {
287
+ QVariant v = feature.attribute ( mFilterFields [i] );
288
+ QString f = v.isNull () ? nullValue : v.toString ();
289
+ mFilterComboBoxes .at ( i )->setCurrentIndex ( mFilterComboBoxes .at ( i )->findText ( f ) );
290
+ }
291
+ }
292
+
279
293
int i = mComboBox ->findData ( mFeature .id (), QgsAttributeTableModel::FeatureIdRole );
280
294
if ( i == -1 && mAllowNull )
281
295
{
@@ -951,12 +965,12 @@ void QgsRelationReferenceWidget::disableChainedComboBoxes( const QComboBox *scb
951
965
continue ;
952
966
}
953
967
968
+ cb->setCurrentIndex ( 0 );
954
969
if ( ccb->currentIndex () == 0 )
955
970
{
956
- cb->setCurrentIndex ( 0 );
957
971
cb->setEnabled ( false );
958
972
}
959
- else
960
- ccb = cb;
973
+
974
+ ccb = cb;
961
975
}
962
976
}
You can’t perform that action at this time.
0 commit comments