summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-15 12:01:56 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-15 11:14:46 -0800
commitbae41ddafb95a56e29f3ef423288197b98b3fa68 (patch)
tree3c67c046454140ea1ad2862095bd082eaf69f555 /qt-ui
parent1e63579cc6b83e3c89ea4232148119ec3e703bbe (diff)
downloadsubsurface-bae41ddafb95a56e29f3ef423288197b98b3fa68.tar.gz
Maintain opened the trips of the selected dive.
In various occasions the branches of selected dives got collapsed because I'm dummy boy and didn't programmed the logic correctly. This one correctly works for the few cases that I'v tried, I'm verifying if the current selected index is a trip or a dive, and asking to expand it. The expanded state is lost because we delete and recreate the model ( and we do that because we can switch between tree and table model ). Now I think we correctly track the cornercases. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelistview.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 89ee6a6e7..da4229de8 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -274,9 +274,15 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
}
}
setupUi();
- QModelIndex curr = selectionModel()->currentIndex();
- if (curr.parent().isValid() && !isExpanded(curr.parent()))
- expand(curr.parent());
+ if(selectedIndexes().count()){
+ QModelIndex curr = selectedIndexes().first();
+ curr = curr.parent().isValid() ? curr.parent() : curr;
+ if(!isExpanded(curr)){
+ setAnimated(false);
+ expand(curr);
+ setAnimated(true);
+ }
+ }
}
void DiveListView::reloadHeaderActions()