Changeset View
Changeset View
Standalone View
Standalone View
src/browsers/playlistbrowser/QtGroupingProxy.cpp
Show First 20 Lines • Show All 818 Lines • ▼ Show 20 Line(s) | 818 | { | |||
---|---|---|---|---|---|
819 | //HACK: we are going to iterate the hash in reverse so calls to endRemoveRows() | 819 | //HACK: we are going to iterate the hash in reverse so calls to endRemoveRows() | ||
820 | // are matched up with the beginRemoveRows() in modelRowsAboutToBeRemoved() | 820 | // are matched up with the beginRemoveRows() in modelRowsAboutToBeRemoved() | ||
821 | //NOTE: easier to do reverse with java style iterator | 821 | //NOTE: easier to do reverse with java style iterator | ||
822 | QMutableHashIterator<quint32, QList<int> > it( m_groupHash ); | 822 | QMutableHashIterator<quint32, QList<int> > it( m_groupHash ); | ||
823 | it.toBack(); | 823 | it.toBack(); | ||
824 | while( it.hasPrevious() ) | 824 | while( it.hasPrevious() ) | ||
825 | { | 825 | { | ||
826 | it.previous(); | 826 | it.previous(); | ||
827 | int groupIndex = it.key(); | | |||
828 | //has to be a modifiable reference for remove and replace operations | 827 | //has to be a modifiable reference for remove and replace operations | ||
829 | QList<int> &groupList = it.value(); | 828 | QList<int> &groupList = it.value(); | ||
830 | int rowIndex = groupList.indexOf( start ); | 829 | int rowIndex = groupList.indexOf( start ); | ||
831 | if( rowIndex != -1 ) | 830 | if( rowIndex != -1 ) | ||
832 | { | 831 | { | ||
833 | QModelIndex proxyParent = index( groupIndex, 0 ); | | |||
834 | groupList.removeAt( rowIndex ); | 832 | groupList.removeAt( rowIndex ); | ||
835 | } | 833 | } | ||
836 | //Now decrement all source rows that are after the removed row | 834 | //Now decrement all source rows that are after the removed row | ||
837 | for( int j = 0; j < groupList.count(); j++ ) | 835 | for( int j = 0; j < groupList.count(); j++ ) | ||
838 | { | 836 | { | ||
839 | int sourceRow = groupList.at( j ); | 837 | int sourceRow = groupList.at( j ); | ||
840 | if( sourceRow > start ) | 838 | if( sourceRow > start ) | ||
841 | groupList.replace( j, sourceRow-1 ); | 839 | groupList.replace( j, sourceRow-1 ); | ||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |