desktop: unglobalize ComboBox-models

The combo-boxes (cylinder type, weightsystem, etc.) were controlled
by global models. Keeping these models up-to-date was very combersome
and buggy.

Create a new model everytime a combobox is opened. Ultimately it
might even be better to create a copy of the strings and switch
to simple QStringListModel. Set data in the core directly and
don't do this via the models.

The result is much simpler and easier to handle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-30 13:40:00 +01:00 committed by Michael Keller
parent de313bd01a
commit 0d011231e6
16 changed files with 130 additions and 215 deletions

View file

@ -42,11 +42,8 @@ void PreferencesEquipment::syncSettings()
equipment->set_default_cylinder(ui->default_cylinder->currentText());
// In case the user changed the tank info settings,
// reset the tank_info_table and inform the TankInfoModel of
// the changed table. It is somewhat questionable to do this here.
// Moreover, it is a bit crude, as this will be called for *any*
// preferences change. Perhaps, the model should listen to the
// precise changed signal of the preferences system?
// reset the tank_info_table. It is somewhat questionable
// to do this here. Moreover, it is a bit crude, as this
// will be called for *any* preferences change.
reset_tank_info_table(&tank_info_table);
TankInfoModel::instance()->update();
}