Planner: Add combo box for dive mode selection

I am not really sure what I am doing here but I copied
code from the gas selection.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-05-08 17:26:48 +02:00 committed by Lubomir I. Ivanov
parent 969dfee9ec
commit b8c94cad69
6 changed files with 71 additions and 0 deletions

View file

@ -67,6 +67,36 @@ QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
}
return QStringListModel::data(index, role);
}
// Dive Type Model for the divetype combo box
Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex &index) const
{
Q_UNUSED(index);
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
DiveTypeSelectionModel *DiveTypeSelectionModel::instance()
{
static DiveTypeSelectionModel self;
return &self;
}
void DiveTypeSelectionModel::repopulate()
{
QStringList modes = QStringList();
for (int i = 0; i < FREEDIVE; i++)
modes.append(QString(divemode_text[i]));
setStringList(modes);
}
QVariant DiveTypeSelectionModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::FontRole) {
return defaultModelFont();
}
return QStringListModel::data(index, role);
}
// Language Model, The Model to populate the list of possible Languages.