mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Also changes the size and working pressure of the cylinders
this is more a 'Well, this is how we do it' than an actuall good commit. I'm probably using the wrong conversion paradigm ( none ) to convert the data from psi / bar and such, it changes the model with wrong data. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
babbfa9204
commit
87d3cd5234
1 changed files with 9 additions and 0 deletions
|
@ -77,7 +77,16 @@ void TankInfoDelegate::setEditorData(QWidget* editor, const QModelIndex& index)
|
|||
void TankInfoDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
||||
{
|
||||
QComboBox *c = static_cast<QComboBox*>(editor);
|
||||
|
||||
TankInfoModel *tanks = TankInfoModel::instance();
|
||||
QModelIndex tankIndex = tanks->match(tanks->index(0,0), Qt::DisplayRole, c->currentText()).first();
|
||||
|
||||
int tankSize = tanks->data(tanks->index(tankIndex.row(), TankInfoModel::ML)).toInt();
|
||||
int tankPressure = tanks->data(tanks->index(tankIndex.row(), TankInfoModel::BAR)).toInt();
|
||||
|
||||
model->setData(index, c->currentText(), Qt::EditRole);
|
||||
model->setData(model->index(index.row(), CylindersModel:: SIZE), tankSize );
|
||||
model->setData(model->index(index.row(), CylindersModel::WORKINGPRESS), tankPressure);
|
||||
}
|
||||
|
||||
TankInfoDelegate::TankInfoDelegate(QObject* parent): QStyledItemDelegate(parent)
|
||||
|
|
Loading…
Add table
Reference in a new issue