Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MDBReleasesModel::sort( int column, Qt::SortOrder order )
- {
- QHash<int, int> mapping;
- MDBModelSorter sorter( mReleases, mapping, column, Qt::DisplayRole );
- sorter.sort( order );
- const QModelIndexList oldList = persistentIndexList();
- QModelIndexList newList;
- emit layoutAboutToBeChanged();
- foreach ( const QModelIndex& index, oldList ) {
- const int nativeRow = mSortMapping.value( index.row(), index.row() );
- newList << createIndex( mapping.key( nativeRow ), index.column() );
- }
- mSortMapping = mapping;
- changePersistentIndexList( oldList, newList );
- emit layoutChanged();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement