mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
de313bd01a
commit
0d011231e6
16 changed files with 130 additions and 215 deletions
|
@ -18,9 +18,10 @@ Qt::ItemFlags GasSelectionModel::flags(const QModelIndex&) const
|
|||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
void GasSelectionModel::repopulate(const dive *d)
|
||||
GasSelectionModel::GasSelectionModel(const dive &d, QObject *parent)
|
||||
: QStringListModel(parent)
|
||||
{
|
||||
setStringList(get_dive_gas_list(d));
|
||||
setStringList(get_dive_gas_list(&d));
|
||||
}
|
||||
|
||||
QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
|
||||
|
@ -37,7 +38,7 @@ Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex&) const
|
|||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
DiveTypeSelectionModel::DiveTypeSelectionModel()
|
||||
DiveTypeSelectionModel::DiveTypeSelectionModel(QObject *parent) : QStringListModel(parent)
|
||||
{
|
||||
QStringList modes;
|
||||
for (int i = 0; i < FREEDIVE; i++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue