Skip to content

Commit

Permalink
* Fixed alignment of playlist headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jan 23, 2012
1 parent 9f99108 commit fdb13a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
40 changes: 26 additions & 14 deletions src/libtomahawk/playlist/trackmodel.cpp
Expand Up @@ -138,20 +138,7 @@ TrackModel::data( const QModelIndex& index, int role ) const

if ( role == Qt::TextAlignmentRole )
{
switch( index.column() )
{
case Age:
case AlbumPos:
case Bitrate:
case Duration:
case Filesize:
case Year:
return Qt::AlignHCenter;
break;

default:
return Qt::AlignLeft;
}
return QVariant( columnAlignment( index.column() ) );
}

if ( role == StyleRole )
Expand Down Expand Up @@ -262,6 +249,11 @@ TrackModel::headerData( int section, Qt::Orientation orientation, int role ) con
return headers.at( section );
}

if ( role == Qt::TextAlignmentRole )
{
return QVariant( columnAlignment( section ) );
}

return QVariant();
}

Expand Down Expand Up @@ -560,3 +552,23 @@ TrackModel::setStyle( TrackModel::TrackItemStyle style )
{
m_style = style;
}


Qt::Alignment
TrackModel::columnAlignment( int column ) const
{
switch( column )
{
case Age:
case AlbumPos:
case Bitrate:
case Duration:
case Filesize:
case Year:
return Qt::AlignHCenter;
break;

default:
return Qt::AlignLeft;
}
}
2 changes: 2 additions & 0 deletions src/libtomahawk/playlist/trackmodel.h
Expand Up @@ -136,6 +136,8 @@ private slots:
void onPlaybackStopped();

private:
Qt::Alignment columnAlignment( int column ) const;

TrackModelItem* m_rootItem;
QPersistentModelIndex m_currentIndex;
Tomahawk::QID m_currentUuid;
Expand Down

0 comments on commit fdb13a1

Please sign in to comment.