mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
* Elide temporary page's text when showing the delete button.
This commit is contained in:
@@ -526,8 +526,6 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
if ( !index.parent().parent().isValid() )
|
if ( !index.parent().parent().isValid() )
|
||||||
o.rect.adjust( 7, 0, 0, 0 );
|
o.rect.adjust( 7, 0, 0, 0 );
|
||||||
|
|
||||||
QStyledItemDelegate::paint( painter, o, index );
|
|
||||||
|
|
||||||
if ( type == SourcesModel::TemporaryPage )
|
if ( type == SourcesModel::TemporaryPage )
|
||||||
{
|
{
|
||||||
TemporaryPageItem* gpi = qobject_cast< TemporaryPageItem* >( item );
|
TemporaryPageItem* gpi = qobject_cast< TemporaryPageItem* >( item );
|
||||||
@@ -535,16 +533,24 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
|
|
||||||
if ( gpi && o3.state & QStyle::State_MouseOver )
|
if ( gpi && o3.state & QStyle::State_MouseOver )
|
||||||
{
|
{
|
||||||
// draw close icon
|
|
||||||
int padding = 3;
|
int padding = 3;
|
||||||
m_iconHeight = ( o3.rect.height() - 2 * padding );
|
m_iconHeight = ( o3.rect.height() - 2 * padding );
|
||||||
|
|
||||||
|
o.rect.adjust( 0, 0, -( padding + m_iconHeight ), 0 );
|
||||||
|
QStyledItemDelegate::paint( painter, o, index );
|
||||||
|
|
||||||
|
// draw close icon
|
||||||
QPixmap p( RESPATH "images/list-remove.png" );
|
QPixmap p( RESPATH "images/list-remove.png" );
|
||||||
p = p.scaledToHeight( m_iconHeight, Qt::SmoothTransformation );
|
p = p.scaledToHeight( m_iconHeight, Qt::SmoothTransformation );
|
||||||
|
|
||||||
QRect r( o3.rect.right() - padding - m_iconHeight, padding + o3.rect.y(), m_iconHeight, m_iconHeight );
|
QRect r( o3.rect.right() - padding - m_iconHeight, padding + o3.rect.y(), m_iconHeight, m_iconHeight );
|
||||||
painter->drawPixmap( r, p );
|
painter->drawPixmap( r, p );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
QStyledItemDelegate::paint( painter, o, index );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
QStyledItemDelegate::paint( painter, o, index );
|
||||||
}
|
}
|
||||||
|
|
||||||
paintDecorations( painter, o3, index );
|
paintDecorations( painter, o3, index );
|
||||||
|
Reference in New Issue
Block a user