mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: use C++ structures for tanksystem info
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3bfbf12b9a
commit
5f36c8ccde
13 changed files with 77 additions and 106 deletions
|
|
@ -7,12 +7,12 @@
|
|||
|
||||
QVariant TankInfoModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.row() < 0 || index.row() >= tank_info_table.nr)
|
||||
if (index.row() < 0 || index.row() >= (int)tank_info_table.size())
|
||||
return QVariant();
|
||||
if (role == Qt::FontRole)
|
||||
return defaultModelFont();
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
const struct tank_info &info = tank_info_table.infos[index.row()];
|
||||
const struct tank_info &info = tank_info_table[index.row()];
|
||||
int ml = info.ml;
|
||||
double bar = (info.psi) ? psi_to_bar(info.psi) : info.bar;
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ QVariant TankInfoModel::data(const QModelIndex &index, int role) const
|
|||
case ML:
|
||||
return ml;
|
||||
case DESCRIPTION:
|
||||
return info.name;
|
||||
return QString::fromStdString(info.name);
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
|
|
@ -33,7 +33,7 @@ QVariant TankInfoModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
int TankInfoModel::rowCount(const QModelIndex&) const
|
||||
{
|
||||
return tank_info_table.nr;
|
||||
return (int)tank_info_table.size();
|
||||
}
|
||||
|
||||
TankInfoModel::TankInfoModel(QObject *parent) : CleanerTableModel(parent)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue