mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
* Get rid of descColor in sidebar's delegate.
This commit is contained in:
@@ -221,7 +221,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
|
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
|
||||||
|
|
||||||
const int iconRectVertMargin = 6;
|
const int iconRectVertMargin = 6;
|
||||||
QRect iconRect = option.rect.adjusted( 20, iconRectVertMargin, -option.rect.width() + option.rect.height() - 12 + 20, -iconRectVertMargin );
|
const QRect iconRect = option.rect.adjusted( 20, iconRectVertMargin, -option.rect.width() + option.rect.height() - 12 + 20, -iconRectVertMargin );
|
||||||
QString name = index.data().toString();
|
QString name = index.data().toString();
|
||||||
QPixmap avatar;
|
QPixmap avatar;
|
||||||
int figWidth = 0;
|
int figWidth = 0;
|
||||||
@@ -289,14 +289,6 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
painter->setOpacity( 1.0 );
|
painter->setOpacity( 1.0 );
|
||||||
painter->drawPixmap( iconRect, avatar );
|
painter->drawPixmap( iconRect, avatar );
|
||||||
|
|
||||||
QColor descColor = option.palette.color( QPalette::Text ).lighter( 180 );
|
|
||||||
if ( type == SourcesModel::ScriptCollection && //you cannot select a non-script collection anyway
|
|
||||||
option.state.testFlag( QStyle::State_Selected ) )
|
|
||||||
{
|
|
||||||
// painter->setPen( option.palette.color( QPalette::HighlightedText ) );
|
|
||||||
// descColor = option.palette.color( QPalette::HighlightedText );
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect textRect = option.rect.adjusted( iconRect.width() + 28, 6, -figWidth - ( figWidth ? 28 : 0 ), 0 );
|
QRect textRect = option.rect.adjusted( iconRect.width() + 28, 6, -figWidth - ( figWidth ? 28 : 0 ), 0 );
|
||||||
QString text = painter->fontMetrics().elidedText( name, Qt::ElideRight, textRect.width() );
|
QString text = painter->fontMetrics().elidedText( name, Qt::ElideRight, textRect.width() );
|
||||||
{
|
{
|
||||||
@@ -365,9 +357,6 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_lockRects.remove( index );
|
m_lockRects.remove( index );
|
||||||
|
|
||||||
if ( isPlaying )
|
|
||||||
descColor = option.palette.color( QPalette::Text );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,17 +371,14 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
|
|
||||||
if ( shouldDrawDropHint )
|
if ( shouldDrawDropHint )
|
||||||
{
|
{
|
||||||
descColor = option.palette.color( QPalette::Text ).lighter( 180 );
|
|
||||||
desc = tr( "Drop to send tracks" );
|
desc = tr( "Drop to send tracks" );
|
||||||
}
|
}
|
||||||
|
|
||||||
text = painter->fontMetrics().elidedText( desc, Qt::ElideRight, textRect.width() - 8 );
|
text = painter->fontMetrics().elidedText( desc, Qt::ElideRight, textRect.width() - 8 );
|
||||||
{
|
{
|
||||||
QTextOption to( Qt::AlignVCenter );
|
QTextOption to( Qt::AlignVCenter );
|
||||||
|
|
||||||
to.setWrapMode( QTextOption::NoWrap );
|
to.setWrapMode( QTextOption::NoWrap );
|
||||||
|
|
||||||
// painter->setPen( descColor );
|
|
||||||
painter->setOpacity( 0.4 );
|
painter->setOpacity( 0.4 );
|
||||||
painter->drawText( textRect, text, to );
|
painter->drawText( textRect, text, to );
|
||||||
}
|
}
|
||||||
@@ -423,9 +409,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
if ( shouldDrawDropHint )
|
if ( shouldDrawDropHint )
|
||||||
{
|
{
|
||||||
QRect figRect = option.rect.adjusted( option.rect.width() - figWidth - iconRectVertMargin, iconRectVertMargin, -iconRectVertMargin, -iconRectVertMargin );
|
QRect figRect = option.rect.adjusted( option.rect.width() - figWidth - iconRectVertMargin, iconRectVertMargin, -iconRectVertMargin, -iconRectVertMargin );
|
||||||
painter->drawPixmap( figRect, TomahawkUtils::defaultPixmap( TomahawkUtils::Inbox,
|
painter->drawPixmap( figRect, TomahawkUtils::defaultPixmap( TomahawkUtils::Inbox, TomahawkUtils::Original, figRect.size() ) );
|
||||||
TomahawkUtils::Original,
|
|
||||||
figRect.size() ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user