I created a field of type ValueRelation allowing multiple selections in PyQGIS. Everything works as it should in the attribute table (see here for example). Now I'm trying to create a custom .ui in QtDesigner. And I can't figure out which widget to use for my field to work properly with the .ui. If I use a listView/listWidget, nothing shows in the list. If I use a comboBox, my list of values shows in the comboBox, but I can't select more than one value (and if I select multiple values directly in the attribute table, then none of them is selected in the comboBox). What is the appropriate QtDesigner Widget to use for multiple selections ValueRelations ?
In case this helps, here's the code I use to populate the list (and that works and poulates the list with the comboBox, but not with the listView/listWidget) :
layer_ref_milieux=QgsProject.instance().mapLayersByName('REF_grds_types_milieux')[0].id()
type_grds_types = 'ValueRelation'
config_grds_types = {'AllowMulti': True,
'AllowNull': True,
'FilterExpression': '',
'Key': 'grd_type_short',
'Layer': layer_ref_milieux,
'LayerName': 'REF_grds_types_milieux',
'LayerSource': 'dbname=' + bdd + ' host=' + host + ' port=' + port + ' user=' + user + ' key=\'id\' checkPrimaryKeyUnicity=\'1\' table="ref"."grds_types_milieux" (geom) sql=',
'NofColumns': 1,
'OrderByValue': True,
'UseCompleter': False,
'Value': 'grd_type'}
grds_types_widget_setup = QgsEditorWidgetSetup(type_grds_types,config_grds_types)
layer.setEditorWidgetSetup(grds_types_index, grds_types_widget_setup)