diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-08-16 12:31:09 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-08-16 12:31:09 -0300 |
commit | cbbc7d99ea039b0b5bd676ec1802555d3707e0af (patch) | |
tree | 08e82ccd82300c796c86593e90df4016715d8dbd | |
parent | 2fb2918607ffb857543b9060fd9f18f0d07ab780 (diff) | |
download | subsurface-cbbc7d99ea039b0b5bd676ec1802555d3707e0af.tar.gz |
Fix for double-rendering, double selection and other annoyances.
This patch fixes a thing that I run into when trying to implement
the multi-edition system. Whenever a dive was selected, via mouse
or keyboard, it had two stages: first, it would select the previous
and the current ( and thus, render the profile of the current) and
then whould release the previous and select the current again ( and
thus, rerendering the profile again, plus a few other things. )
With the multi-edition system this caused a more severe bug, since
the edition of the dives is directly applied as soon as the text fields
changes, as soon as we selected any dive on the list, the 'before' dive
would be modified by the 'current'. This patch fixes this - but since it's
just a 'code removal' patch, this can led to bad things in the future,
I tested it quite a bit, but didn't found anything, no regression.
*fingers crossed.*
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r-- | qt-ui/divelistview.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 4b856f601..2e40678ad 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -226,16 +226,7 @@ void DiveListView::currentChanged(const QModelIndex& current, const QModelIndex& { if (!current.isValid()) return; - const QAbstractItemModel *model = current.model(); - int selectedDive = 0; - struct dive *dive = (struct dive*) model->data(current, DiveTripModel::DIVE_ROLE).value<void*>(); - if (!dive) // it's a trip! select first child. - dive = (struct dive*) model->data(current.child(0,0), DiveTripModel::DIVE_ROLE).value<void*>(); - selectedDive = get_divenr(dive); scrollTo(current); - if (selectedDive == selected_dive) - return; - Q_EMIT currentDiveChanged(selectedDive); } void DiveListView::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) |