File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -941,6 +941,18 @@ void QgsRelationReferenceWidget::filterChanged()
941
941
}
942
942
943
943
mFilterModel ->setFilteredFeatures ( featureIds );
944
+
945
+ if ( mChainFilters && mComboBox ->count () > 0 )
946
+ {
947
+ if ( scb->currentIndex () == 0 )
948
+ {
949
+ mComboBox ->setCurrentIndex ( 0 );
950
+ }
951
+ else if ( mComboBox ->count () > 1 )
952
+ {
953
+ mComboBox ->setCurrentIndex ( 1 );
954
+ }
955
+ }
944
956
}
945
957
946
958
void QgsRelationReferenceWidget::addEntry ()
Original file line number Diff line number Diff line change @@ -174,8 +174,20 @@ void TestQgsRelationReferenceWidget::testChainFilter()
174
174
175
175
// set the filter for "raccord" and then reset filter for "diameter". As
176
176
// chain filter is activated, the filter on "raccord" field should be reset
177
+ cbs[0 ]->setCurrentIndex ( 0 );
178
+ QCOMPARE ( w.mComboBox ->currentIndex (), 0 );
179
+
180
+ cbs[0 ]->setCurrentIndex ( cbs[0 ]->findText ( " iron" ) );
181
+ QCOMPARE ( w.mComboBox ->currentIndex (), 1 );
182
+
183
+ cbs[1 ]->setCurrentIndex ( cbs[1 ]->findText ( " 120" ) );
184
+ QCOMPARE ( w.mComboBox ->currentIndex (), 1 );
185
+
177
186
cbs[2 ]->setCurrentIndex ( cbs[2 ]->findText ( " brides" ) );
187
+ QCOMPARE ( w.mComboBox ->currentIndex (), 1 );
188
+
178
189
cbs[1 ]->setCurrentIndex ( cbs[1 ]->findText ( " diameter" ) );
190
+ QCOMPARE ( w.mComboBox ->currentIndex (), 0 );
179
191
180
192
// combobox should propose NULL, 10 and 11 because the filter is now:
181
193
// "material" == 'iron'
You can’t perform that action at this time.
0 commit comments