summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-13 18:07:10 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-14 21:26:33 +0900
commit77a1ef9ebec188865c01b08b32ea1fde29575e69 (patch)
tree70ca0d45ad2eedf94c9360b2b5add38a7bdbec60 /qt-ui/divelistview.cpp
parent942c8632ded0d760f53918ef84e57dd599fe8804 (diff)
downloadsubsurface-77a1ef9ebec188865c01b08b32ea1fde29575e69.tar.gz
Expand the trip of the first selected dive.
I probably broke this a while ago, as I was not using the big dirk dive file to test ( just using some random files over the test folder. ) Now it's working as it should. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 9c30f99e4..c1dde082b 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -104,25 +104,21 @@ int DiveListView::lastVisibleColumn()
void DiveListView::backupExpandedRows(){
expandedRows.clear();
- for(int i = 0; i < model()->rowCount(); i++){
- if(isExpanded( model()->index(i, 0) )){
+ for(int i = 0; i < model()->rowCount(); i++)
+ if(isExpanded( model()->index(i, 0) ))
expandedRows.push_back(i);
- }
- }
}
void DiveListView::restoreExpandedRows(){
- Q_FOREACH(const int &i, expandedRows){
+ Q_FOREACH(const int &i, expandedRows)
setExpanded( model()->index(i, 0), true );
- }
}
void DiveListView::fixMessyQtModelBehaviour()
{
QAbstractItemModel *m = model();
- for(int i = 0; i < model()->rowCount(); i++){
+ for(int i = 0; i < model()->rowCount(); i++)
if (m->rowCount( m->index(i, 0) ) != 0)
setFirstColumnSpanned(i, QModelIndex(), true);
- }
}
// this only remembers dives that were selected, not trips
@@ -278,6 +274,9 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
}
}
setupUi();
+ QModelIndex curr = selectionModel()->currentIndex();
+ if (curr.parent().isValid() && !isExpanded(curr.parent()))
+ expand(curr.parent());
}
void DiveListView::reloadHeaderActions()