mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
* Clean up TrackModel / TrackProxyModel API a bit.
This commit is contained in:
@@ -16,8 +16,8 @@ CollectionProxyModel::CollectionProxyModel( QObject* parent )
|
|||||||
bool
|
bool
|
||||||
CollectionProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
CollectionProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
||||||
{
|
{
|
||||||
PlItem* p1 = ((PlaylistInterface*)model())->itemFromIndex( left );
|
PlItem* p1 = itemFromIndex( left );
|
||||||
PlItem* p2 = ((PlaylistInterface*)model())->itemFromIndex( right );
|
PlItem* p2 = itemFromIndex( right );
|
||||||
|
|
||||||
if ( !p1 )
|
if ( !p1 )
|
||||||
return true;
|
return true;
|
||||||
|
@@ -23,7 +23,7 @@ public:
|
|||||||
virtual int rowCount( const QModelIndex& parent ) const;
|
virtual int rowCount( const QModelIndex& parent ) const;
|
||||||
virtual int columnCount( const QModelIndex& parent ) const;
|
virtual int columnCount( const QModelIndex& parent ) const;
|
||||||
|
|
||||||
virtual QVariant data( const QModelIndex& index, int role ) const;
|
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
|
||||||
virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
|
virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
|
||||||
|
|
||||||
virtual PlItem* previousItem() { return 0; }
|
virtual PlItem* previousItem() { return 0; }
|
||||||
|
@@ -132,7 +132,7 @@ TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParen
|
|||||||
if ( filterRegExp().isEmpty() )
|
if ( filterRegExp().isEmpty() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PlItem* pi = ((PlaylistInterface*)model())->itemFromIndex( model()->index( sourceRow, 0, sourceParent ) );
|
PlItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
|
||||||
if ( !pi )
|
if ( !pi )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ Q_OBJECT
|
|||||||
public:
|
public:
|
||||||
explicit TrackProxyModel ( QObject* parent = 0 );
|
explicit TrackProxyModel ( QObject* parent = 0 );
|
||||||
|
|
||||||
virtual TrackModel* model() const { return m_model; }
|
virtual TrackModel* sourceModel() const { return m_model; }
|
||||||
virtual void setSourceModel( TrackModel* sourceModel );
|
virtual void setSourceModel( TrackModel* sourceModel );
|
||||||
|
|
||||||
virtual QPersistentModelIndex currentItem() const { return mapFromSource( m_model->currentItem() ); }
|
virtual QPersistentModelIndex currentItem() const { return mapFromSource( m_model->currentItem() ); }
|
||||||
|
Reference in New Issue
Block a user