mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Add new role for getting item data
This commit is contained in:
@@ -101,25 +101,32 @@ JobStatusModel::data( const QModelIndex& index, int role ) const
|
||||
|
||||
switch ( role )
|
||||
{
|
||||
case Qt::DecorationRole:
|
||||
return item->icon();
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
if ( m_collapseCount.contains( item->type() ) )
|
||||
return m_collapseCount[ item->type() ].last()->mainText();
|
||||
else
|
||||
return item->mainText();
|
||||
}
|
||||
case RightColumnRole:
|
||||
{
|
||||
if ( m_collapseCount.contains( item->type() ) )
|
||||
return m_collapseCount[ item->type() ].count();
|
||||
else
|
||||
return item->rightColumnText();
|
||||
}
|
||||
case AllowMultiLineRole:
|
||||
return item->allowMultiLine();
|
||||
case Qt::DecorationRole:
|
||||
return item->icon();
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
if ( m_collapseCount.contains( item->type() ) )
|
||||
return m_collapseCount[ item->type() ].last()->mainText();
|
||||
else
|
||||
return item->mainText();
|
||||
}
|
||||
|
||||
case RightColumnRole:
|
||||
{
|
||||
if ( m_collapseCount.contains( item->type() ) )
|
||||
return m_collapseCount[ item->type() ].count();
|
||||
else
|
||||
return item->rightColumnText();
|
||||
}
|
||||
|
||||
case AllowMultiLineRole:
|
||||
return item->allowMultiLine();
|
||||
|
||||
case JobDataRole:
|
||||
return QVariant::fromValue< JobStatusItem* >( item );
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
@@ -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 );
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user