mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
* Added PlayableRoles and mapped them to the according column.
This commit is contained in:
@@ -259,15 +259,22 @@ PlayableModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if ( role == Qt::TextAlignmentRole )
|
||||
else if ( role == Qt::TextAlignmentRole )
|
||||
{
|
||||
return QVariant( columnAlignment( index.column() ) );
|
||||
}
|
||||
|
||||
int column = index.column();
|
||||
if ( role >= Qt::UserRole )
|
||||
{
|
||||
// Map user-role to column
|
||||
column = role - Qt::UserRole;
|
||||
role = Qt::DisplayRole;
|
||||
}
|
||||
|
||||
if ( !entry->query().isNull() )
|
||||
{
|
||||
return queryData( entry->query()->displayQuery(), index.column(), role );
|
||||
return queryData( entry->query()->displayQuery(), column, role );
|
||||
}
|
||||
else if ( !entry->artist().isNull() )
|
||||
{
|
||||
|
@@ -38,7 +38,8 @@ class DLLEXPORT PlayableModel : public QAbstractItemModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns {
|
||||
enum Columns
|
||||
{
|
||||
Artist = 0,
|
||||
Track = 1,
|
||||
Composer = 2,
|
||||
@@ -54,6 +55,24 @@ public:
|
||||
Name = 12
|
||||
};
|
||||
|
||||
enum PlayableRoles
|
||||
{
|
||||
ArtistRole = Qt::UserRole,
|
||||
TrackRole,
|
||||
ComposerRole,
|
||||
AlbumRole,
|
||||
AlbumPosRole,
|
||||
DurationRole,
|
||||
BitrateRole,
|
||||
AgeRole,
|
||||
YearRole,
|
||||
FilesizeRole,
|
||||
OriginRole,
|
||||
ScoreRole,
|
||||
NameRole
|
||||
};
|
||||
|
||||
|
||||
explicit PlayableModel( QObject* parent = 0, bool loading = true );
|
||||
virtual ~PlayableModel();
|
||||
|
||||
|
Reference in New Issue
Block a user