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>
This commit is contained in:
Tomaz Canabrava 2013-11-13 18:07:10 -02:00 committed by Dirk Hohndel
parent 942c8632de
commit 77a1ef9ebe

View file

@ -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()