diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-23 15:59:12 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-23 15:59:12 -0300 |
commit | 87d3cd523493e009737887528d2c4040c0280804 (patch) | |
tree | 7e93efd4dceb61d3531e60c8e42a3e5086ca4633 | |
parent | babbfa9204b45d459227bdde0ff63469244b1c39 (diff) | |
download | subsurface-87d3cd523493e009737887528d2c4040c0280804.tar.gz |
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>
-rw-r--r-- | qt-ui/modeldelegates.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 283cf17b0..2dc52e655 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -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) |