mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:53:23 +00:00
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:
parent
942c8632de
commit
77a1ef9ebe
1 changed files with 7 additions and 8 deletions
|
@ -104,25 +104,21 @@ int DiveListView::lastVisibleColumn()
|
||||||
|
|
||||||
void DiveListView::backupExpandedRows(){
|
void DiveListView::backupExpandedRows(){
|
||||||
expandedRows.clear();
|
expandedRows.clear();
|
||||||
for(int i = 0; i < model()->rowCount(); i++){
|
for(int i = 0; i < model()->rowCount(); i++)
|
||||||
if(isExpanded( model()->index(i, 0) )){
|
if(isExpanded( model()->index(i, 0) ))
|
||||||
expandedRows.push_back(i);
|
expandedRows.push_back(i);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListView::restoreExpandedRows(){
|
void DiveListView::restoreExpandedRows(){
|
||||||
Q_FOREACH(const int &i, expandedRows){
|
Q_FOREACH(const int &i, expandedRows)
|
||||||
setExpanded( model()->index(i, 0), true );
|
setExpanded( model()->index(i, 0), true );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void DiveListView::fixMessyQtModelBehaviour()
|
void DiveListView::fixMessyQtModelBehaviour()
|
||||||
{
|
{
|
||||||
QAbstractItemModel *m = model();
|
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)
|
if (m->rowCount( m->index(i, 0) ) != 0)
|
||||||
setFirstColumnSpanned(i, QModelIndex(), true);
|
setFirstColumnSpanned(i, QModelIndex(), true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this only remembers dives that were selected, not trips
|
// this only remembers dives that were selected, not trips
|
||||||
|
@ -278,6 +274,9 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupUi();
|
setupUi();
|
||||||
|
QModelIndex curr = selectionModel()->currentIndex();
|
||||||
|
if (curr.parent().isValid() && !isExpanded(curr.parent()))
|
||||||
|
expand(curr.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListView::reloadHeaderActions()
|
void DiveListView::reloadHeaderActions()
|
||||||
|
|
Loading…
Add table
Reference in a new issue