1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 11:51:44 +02:00

* Fixed sorting of identical items in Tree- & TrackProxyModel.

This commit is contained in:
Christian Muehlhaeuser
2011-08-17 03:33:31 +02:00
parent ac3d410559
commit 35a7acd606
3 changed files with 14 additions and 4 deletions

View File

@@ -396,6 +396,11 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
return size1 < size2;
}
return QString::localeAwareCompare( sourceModel()->data( left ).toString(),
sourceModel()->data( right ).toString() ) < 0;
const QString& lefts = sourceModel()->data( left ).toString();
const QString& rights = sourceModel()->data( right ).toString();
if ( lefts == rights )
return id1 < id2;
return QString::localeAwareCompare( lefts, rights ) < 0;
}

View File

@@ -133,13 +133,19 @@ TreeProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) co
if ( !p2 )
return false;
const QString& lefts = textForItem( p1 );
const QString& rights = textForItem( p2 );
if ( !p1->result().isNull() )
{
if ( p1->result()->albumpos() != p2->result()->albumpos() )
return p1->result()->albumpos() < p2->result()->albumpos();
if ( lefts == rights )
return p1->result()->dbid() < p2->result()->dbid();
}
return QString::localeAwareCompare( textForItem( p1 ), textForItem( p2 ) ) < 0;
return QString::localeAwareCompare( lefts, rights ) < 0;
}

View File

@@ -37,7 +37,6 @@ SourcesProxyModel::SourcesProxyModel( SourcesModel* model, QObject* parent )
setSourceModel( model );
if ( model && model->metaObject()->indexOfSignal( "expandRequest(QModelIndex)" ) > -1 )
connect( model, SIGNAL( expandRequest( QModelIndex ) ), this, SLOT( expandRequested( QModelIndex ) ) );
if ( model && model->metaObject()->indexOfSignal( "selectRequest(QModelIndex)" ) > -1 )