1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Add new role for getting item data

This commit is contained in:
Jeff Mitchell
2012-04-21 11:54:26 -04:00
parent eb0ed267fa
commit fda71bb583
3 changed files with 29 additions and 20 deletions

View File

@@ -103,7 +103,9 @@ JobStatusModel::data( const QModelIndex& index, int role ) const
{
case Qt::DecorationRole:
return item->icon();
case Qt::ToolTipRole:
case Qt::DisplayRole:
{
if ( m_collapseCount.contains( item->type() ) )
@@ -111,6 +113,7 @@ JobStatusModel::data( const QModelIndex& index, int role ) const
else
return item->mainText();
}
case RightColumnRole:
{
if ( m_collapseCount.contains( item->type() ) )
@@ -118,8 +121,12 @@ JobStatusModel::data( const QModelIndex& index, int role ) const
else
return item->rightColumnText();
}
case AllowMultiLineRole:
return item->allowMultiLine();
case JobDataRole:
return QVariant::fromValue< JobStatusItem* >( item );
}
return QVariant();

View File

@@ -35,7 +35,8 @@ public:
// DecorationRole is icon
// DisplayRole is main col
RightColumnRole = Qt::UserRole + 1,
AllowMultiLineRole = Qt::UserRole + 2
AllowMultiLineRole = Qt::UserRole + 2,
JobDataRole = Qt::UserRole + 3
};
explicit JobStatusModel( QObject* parent = 0 );

View File

@@ -409,6 +409,7 @@ TomahawkApp::registerMetaTypes()
qRegisterMetaType< QHash< QString, QMap<quint32, quint16> > >("QHash< QString, QMap<quint32, quint16> >");
qRegisterMetaType< QMap< QString, QMap< unsigned int, unsigned int > > >("QMap< QString, QMap< unsigned int, unsigned int > >");
qRegisterMetaType< PairList >("PairList");
qRegisterMetaType< JobStatusItem* >("JobStatusItem*");
qRegisterMetaType< GeneratorMode>("GeneratorMode");
qRegisterMetaType<Tomahawk::GeneratorMode>("Tomahawk::GeneratorMode");