diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-16 19:13:58 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-16 19:13:58 -0300 |
commit | 1a0a4b7e08df29dcc519dfe35022127e1d5dda20 (patch) | |
tree | 44bb39a5ac166345b5fea20af0d222a49ccd4cf2 /qt-ui/models.cpp | |
parent | c5a0c4e0d7f69be9341cc5c8815afe9761e5c47c (diff) | |
download | subsurface-1a0a4b7e08df29dcc519dfe35022127e1d5dda20.tar.gz |
Fixes the Combobox behavior on the inline-edit
This patch fixes the combobox behavior on the inline edit
to what it was ( well, similar to ) the GTK version,
up and arrow keys will walk you to the list of choices,
and it will update the other data as soon as you walks over it
one drawback is that you cant ( for now, since I do have a
very big headache at the moment ) cancel, since the cancel
will just forgets the item and do not call 'setData' on the
model, but we already called it while walking on the list.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r-- | qt-ui/models.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 80ccf0e73..0991ddb5d 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -161,12 +161,14 @@ void CylindersModel::passInData(const QModelIndex& index, const QVariant& value) if (cyl->type.size.mliter != value.toInt()) { cyl->type.size.mliter = value.toInt(); mark_divelist_changed(TRUE); + dataChanged(index, index); } break; case WORKINGPRESS: if (cyl->type.workingpressure.mbar != value.toInt()) { cyl->type.workingpressure.mbar = value.toInt(); mark_divelist_changed(TRUE); + dataChanged(index, index); } break; } @@ -262,7 +264,8 @@ bool CylindersModel::setData(const QModelIndex& index, const QVariant& value, in } break; } - return QAbstractItemModel::setData(index, value, role); + dataChanged(index, index); + return true; } int CylindersModel::rowCount(const QModelIndex& parent) const @@ -408,6 +411,7 @@ void WeightModel::passInData(const QModelIndex& index, const QVariant& value) if (ws->weight.grams != value.toInt()) { ws->weight.grams = value.toInt(); mark_divelist_changed(TRUE); + dataChanged(index, index); } } } @@ -440,7 +444,8 @@ bool WeightModel::setData(const QModelIndex& index, const QVariant& value, int r } break; } - return QAbstractItemModel::setData(index, value, role); + dataChanged(index, index); + return true; } Qt::ItemFlags WeightModel::flags(const QModelIndex& index) const @@ -540,6 +545,7 @@ bool WSInfoModel::setData(const QModelIndex& index, const QVariant& value, int r info->grams = value.toInt(); break; } + emit dataChanged(index, index); return TRUE; } @@ -680,6 +686,7 @@ bool TankInfoModel::setData(const QModelIndex& index, const QVariant& value, int info->bar = value.toInt(); break; } + emit dataChanged(index, index); return TRUE; } @@ -1275,6 +1282,7 @@ bool DiveComputerModel::setData(const QModelIndex& index, const QVariant& value, dcWorkingMap.remove(node.model, node); node.nickName = value.toString(); dcWorkingMap.insert(node.model, node); + emit dataChanged(index, index); return true; } |