mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 15:29:42 +01:00
Refresh delegates on both add and remove; also, if ACL can't be displayed cause it's the wrong item type, just don't paint anything at all
This commit is contained in:
parent
8a61e89d83
commit
4aadb95f5d
@ -53,6 +53,9 @@ AclJobDelegate::~AclJobDelegate()
|
||||
void
|
||||
AclJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
AclJobItem* item = dynamic_cast< AclJobItem* >( index.data( JobStatusModel::JobDataRole ).value< JobStatusItem* >() );
|
||||
if ( !item )
|
||||
return;
|
||||
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
@ -65,12 +68,7 @@ AclJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
||||
|
||||
painter->fillRect( opt.rect, Qt::lightGray );
|
||||
|
||||
QString mainText;
|
||||
AclJobItem* item = dynamic_cast< AclJobItem* >( index.data( JobStatusModel::JobDataRole ).value< JobStatusItem* >() );
|
||||
if ( !item )
|
||||
mainText = tr( "Error displaying ACL info" );
|
||||
else
|
||||
mainText = QString( tr( "Allow %1 to\nconnect and stream from you?" ) ).arg( item->username() );
|
||||
QString mainText = QString( tr( "Allow %1 to\nconnect and stream from you?" ) ).arg( item->username() );
|
||||
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Displaying text:" << mainText;
|
||||
|
||||
const QRect rRect( opt.rect.left() + PADDING, opt.rect.top() + 4*PADDING, opt.rect.width() - 2*PADDING, opt.rect.height() - 2*PADDING );
|
||||
|
@ -85,6 +85,8 @@ JobStatusModel::addJob( JobStatusItem* item )
|
||||
tLog() << Q_FUNC_INFO << "job has custom delegate";
|
||||
emit customDelegateJobInserted( currentEndRow, item );
|
||||
}
|
||||
|
||||
emit refreshDelegates();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user