mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
The delegate needs a parent at creation, so send the item instead of sending the delegate over
This commit is contained in:
parent
1695b39abf
commit
0b796a3085
@ -31,17 +31,37 @@ JobStatusItem::~JobStatusItem()
|
||||
}
|
||||
|
||||
|
||||
bool JobStatusItem::allowMultiLine() const
|
||||
bool
|
||||
JobStatusItem::allowMultiLine() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool JobStatusItem::collapseItem() const
|
||||
|
||||
bool
|
||||
JobStatusItem::collapseItem() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QStyledItemDelegate* JobStatusItem::customDelegate() const
|
||||
|
||||
bool
|
||||
JobStatusItem::hasCustomDelegate() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusItem::createDelegate( QObject* parent )
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QStyledItemDelegate*
|
||||
JobStatusItem::customDelegate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
virtual bool collapseItem() const;
|
||||
virtual bool allowMultiLine() const;
|
||||
|
||||
virtual bool hasCustomDelegate() const;
|
||||
virtual void createDelegate( QObject* parent );
|
||||
virtual QStyledItemDelegate* customDelegate() const;
|
||||
|
||||
signals:
|
||||
|
@ -71,8 +71,8 @@ JobStatusModel::addJob( JobStatusItem* item )
|
||||
beginInsertRows( QModelIndex(), currentEndRow, currentEndRow );
|
||||
m_items.append( item );
|
||||
endInsertRows();
|
||||
if ( item->customDelegate() )
|
||||
emit customDelegateJobInserted( currentEndRow, item->customDelegate() );
|
||||
if ( item->hasCustomDelegate() )
|
||||
emit customDelegateJobInserted( currentEndRow, item );
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ JobStatusModel::itemFinished()
|
||||
endRemoveRows();
|
||||
|
||||
if ( item->customDelegate() )
|
||||
emit customDelegateJobRemoved( idx, item->customDelegate() );
|
||||
emit customDelegateJobRemoved( idx );
|
||||
|
||||
if ( item->type() == "acljob" )
|
||||
m_aclJobCount--;
|
||||
|
@ -46,8 +46,8 @@ public:
|
||||
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
|
||||
|
||||
signals:
|
||||
void customDelegateJobInserted( int row, QStyledItemDelegate* delegate );
|
||||
void customDelegateJobRemoved( int row, QStyledItemDelegate* delegate );
|
||||
void customDelegateJobInserted( int row, JobStatusItem* item );
|
||||
void customDelegateJobRemoved( int row );
|
||||
|
||||
public slots:
|
||||
/// Takes ownership of job
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "pipeline.h"
|
||||
#include "JobStatusModel.h"
|
||||
#include "JobStatusItem.h"
|
||||
#include "JobStatusDelegate.h"
|
||||
#include "PipelineStatusItem.h"
|
||||
#include "TransferStatusItem.h"
|
||||
@ -92,21 +93,19 @@ JobStatusView::setModel( JobStatusModel* m )
|
||||
|
||||
|
||||
void
|
||||
JobStatusView::customDelegateJobInserted( int row, QStyledItemDelegate* delegate )
|
||||
JobStatusView::customDelegateJobInserted( int row, JobStatusItem* item )
|
||||
{
|
||||
if ( !delegate )
|
||||
if ( !item )
|
||||
return;
|
||||
|
||||
m_view->setItemDelegateForRow( row, delegate );
|
||||
item->createDelegate( m_view );
|
||||
m_view->setItemDelegateForRow( row, item->customDelegate() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusView::customDelegateJobRemoved( int row, QStyledItemDelegate* delegate )
|
||||
JobStatusView::customDelegateJobRemoved( int row )
|
||||
{
|
||||
if ( !delegate )
|
||||
return;
|
||||
|
||||
m_view->setItemDelegateForRow( row, m_view->itemDelegate() );
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
class QAbstractItemModel;
|
||||
class QListView;
|
||||
class JobStatusModel;
|
||||
class JobStatusItem;
|
||||
class StreamConnection;
|
||||
class QStyledItemDelegate;
|
||||
|
||||
@ -52,8 +53,8 @@ public:
|
||||
|
||||
private slots:
|
||||
void checkCount();
|
||||
void customDelegateJobInserted( int row, QStyledItemDelegate* delegate );
|
||||
void customDelegateJobRemoved( int row, QStyledItemDelegate* delegate );
|
||||
void customDelegateJobInserted( int row, JobStatusItem* item );
|
||||
void customDelegateJobRemoved( int row );
|
||||
|
||||
private:
|
||||
QListView* m_view;
|
||||
|
Loading…
x
Reference in New Issue
Block a user