1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

* Fixed alignment of playlist headers.

This commit is contained in:
Christian Muehlhaeuser
2012-01-23 03:20:49 +01:00
parent 9f99108701
commit fdb13a1f78
2 changed files with 28 additions and 14 deletions

View File

@@ -138,20 +138,7 @@ TrackModel::data( const QModelIndex& index, int role ) const
if ( role == Qt::TextAlignmentRole ) if ( role == Qt::TextAlignmentRole )
{ {
switch( index.column() ) return QVariant( columnAlignment( index.column() ) );
{
case Age:
case AlbumPos:
case Bitrate:
case Duration:
case Filesize:
case Year:
return Qt::AlignHCenter;
break;
default:
return Qt::AlignLeft;
}
} }
if ( role == StyleRole ) if ( role == StyleRole )
@@ -262,6 +249,11 @@ TrackModel::headerData( int section, Qt::Orientation orientation, int role ) con
return headers.at( section ); return headers.at( section );
} }
if ( role == Qt::TextAlignmentRole )
{
return QVariant( columnAlignment( section ) );
}
return QVariant(); return QVariant();
} }
@@ -560,3 +552,23 @@ TrackModel::setStyle( TrackModel::TrackItemStyle style )
{ {
m_style = 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;
}
}

View File

@@ -136,6 +136,8 @@ private slots:
void onPlaybackStopped(); void onPlaybackStopped();
private: private:
Qt::Alignment columnAlignment( int column ) const;
TrackModelItem* m_rootItem; TrackModelItem* m_rootItem;
QPersistentModelIndex m_currentIndex; QPersistentModelIndex m_currentIndex;
Tomahawk::QID m_currentUuid; Tomahawk::QID m_currentUuid;