mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-18 20:04:00 +02:00
* Fixed sorting of identical items in Tree- & TrackProxyModel.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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 )
|
||||
|
Reference in New Issue
Block a user