mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +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 )
|
switch ( role )
|
||||||
{
|
{
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return item->icon();
|
return item->icon();
|
||||||
case Qt::ToolTipRole:
|
|
||||||
case Qt::DisplayRole:
|
case Qt::ToolTipRole:
|
||||||
{
|
|
||||||
if ( m_collapseCount.contains( item->type() ) )
|
case Qt::DisplayRole:
|
||||||
return m_collapseCount[ item->type() ].last()->mainText();
|
{
|
||||||
else
|
if ( m_collapseCount.contains( item->type() ) )
|
||||||
return item->mainText();
|
return m_collapseCount[ item->type() ].last()->mainText();
|
||||||
}
|
else
|
||||||
case RightColumnRole:
|
return item->mainText();
|
||||||
{
|
}
|
||||||
if ( m_collapseCount.contains( item->type() ) )
|
|
||||||
return m_collapseCount[ item->type() ].count();
|
case RightColumnRole:
|
||||||
else
|
{
|
||||||
return item->rightColumnText();
|
if ( m_collapseCount.contains( item->type() ) )
|
||||||
}
|
return m_collapseCount[ item->type() ].count();
|
||||||
case AllowMultiLineRole:
|
else
|
||||||
return item->allowMultiLine();
|
return item->rightColumnText();
|
||||||
|
}
|
||||||
|
|
||||||
|
case AllowMultiLineRole:
|
||||||
|
return item->allowMultiLine();
|
||||||
|
|
||||||
|
case JobDataRole:
|
||||||
|
return QVariant::fromValue< JobStatusItem* >( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@@ -35,7 +35,8 @@ public:
|
|||||||
// DecorationRole is icon
|
// DecorationRole is icon
|
||||||
// DisplayRole is main col
|
// DisplayRole is main col
|
||||||
RightColumnRole = Qt::UserRole + 1,
|
RightColumnRole = Qt::UserRole + 1,
|
||||||
AllowMultiLineRole = Qt::UserRole + 2
|
AllowMultiLineRole = Qt::UserRole + 2,
|
||||||
|
JobDataRole = Qt::UserRole + 3
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit JobStatusModel( QObject* parent = 0 );
|
explicit JobStatusModel( QObject* parent = 0 );
|
||||||
|
@@ -409,6 +409,7 @@ TomahawkApp::registerMetaTypes()
|
|||||||
qRegisterMetaType< QHash< QString, QMap<quint32, quint16> > >("QHash< QString, QMap<quint32, quint16> >");
|
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< QMap< QString, QMap< unsigned int, unsigned int > > >("QMap< QString, QMap< unsigned int, unsigned int > >");
|
||||||
qRegisterMetaType< PairList >("PairList");
|
qRegisterMetaType< PairList >("PairList");
|
||||||
|
qRegisterMetaType< JobStatusItem* >("JobStatusItem*");
|
||||||
|
|
||||||
qRegisterMetaType< GeneratorMode>("GeneratorMode");
|
qRegisterMetaType< GeneratorMode>("GeneratorMode");
|
||||||
qRegisterMetaType<Tomahawk::GeneratorMode>("Tomahawk::GeneratorMode");
|
qRegisterMetaType<Tomahawk::GeneratorMode>("Tomahawk::GeneratorMode");
|
||||||
|
Reference in New Issue
Block a user