1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 21:27:58 +02:00

* Clean up TrackModel / TrackProxyModel API a bit.

This commit is contained in:
Christian Muehlhaeuser
2010-10-23 09:20:24 +02:00
parent 5ed57069d3
commit bf43dadac9
4 changed files with 5 additions and 5 deletions

View File

@@ -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;

View File

@@ -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; }

View File

@@ -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;

View File

@@ -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() ); }