set_where_condition in Comboboxdelegate with selected value in another comboboxdelegate

0

I have two comboboxdelegates .

 BlGenericComboBoxDelegate *cbd_id_tipo_tubo = new BlGenericComboBoxDelegate(mainCompany(), this);
    cbd_id_tipo_tubo->set_foreign_table("presu.tipo_tubo", "id", "tipo");
    cbd_id_tipo_tubo->set_foreign_field(columnNumber("id_tipo_tubo"), "id_tipo_tubo");
    cbd_id_tipo_tubo->setAllowNull(false);
    cbd_id_tipo_tubo->initialize("_tubo");
    mui_list->setItemDelegateForColumn(columnNumber("_tubo"), cbd_id_tipo_tubo);




BlGenericComboBoxDelegate *cbd_id_tipo_medida = new BlGenericComboBoxDelegate(mainCompany(), this);
    cbd_id_tipo_medida->set_foreign_table("presu.medidas_tipo_tubo","id", "medida");
cbd_id_tipo_medida->set_foreign_field(columnNumber("id_medidas_tipo_tubo"), "id_medidas_tipo_tubo"); 

cbd_id_tipo_medida->set_where_condition( 

**AQUI VALOR DEL PRIMER COMBO (id_tipo_tubo));

    cbd_id_tipo_medida->setAllowNull(false);
    cbd_id_tipo_medida->initialize("_medida");
    mui_list->setItemDelegateForColumn(columnNumber("_medida"), cbd_id_tipo_medida);

These combobox appear in a line of a sub-form Qtableview , and I want the item selected in the first combobox to be the where of the second.

I've tried with currenttext and so on, but they are combobox , not comboboxdelegate and I can not get the id_tipo_tubo of the first comboboxdelegate .

Thanks

    
asked by user3158502 11.12.2018 в 11:47
source

1 answer

1

In my case, it is solved in this way. Since the reference of the id column of the foreign key of the combobox was missing.

Adding this line in the combobox, it is solved.

cbd_id_tipo_medida->set_filter_id("id_tipo_tubo", "id_tipo_tubo", true);                                           
    
answered by 11.12.2018 в 14:21