optimize: qGreater was obsolete use std::less instead

This commit is contained in:
YiFang Xiao 2022-03-20 19:13:50 +08:00
parent f4ab1ed6a6
commit baf6685618

View file

@ -907,9 +907,8 @@ void FavoritesModel::removeItemsForIndexes( const QModelIndexList & idxList )
for( int i = lowestLevel; i >= 0; i-- ) for( int i = lowestLevel; i >= 0; i-- )
{ {
QModelIndexList idxSublist = itemsToDelete[ i ]; QModelIndexList idxSublist = itemsToDelete[ i ];
//std::greater does not work ,operator < not implemented ,use std:less first ,then std::reverse. // std::greater does not work as operator < not implemented
std::sort(idxSublist.begin(), idxSublist.end(), std::less<QModelIndex>()); std::sort( idxSublist.begin(), idxSublist.end(), std::not2( std::less< QModelIndex >() ) );
std::reverse(idxSublist.begin(), idxSublist.end());
it = idxSublist.begin(); it = idxSublist.begin();
for( ; it != idxSublist.end(); ++it ) for( ; it != idxSublist.end(); ++it )