1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 07:36:48 +02:00

Fix crash and shrink headphones

This commit is contained in:
Leo Franchi
2011-09-23 10:49:59 -04:00
parent efbbdf1e72
commit 18d9360ad3

View File

@@ -201,7 +201,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
if ( !pm.isNull() ) if ( !pm.isNull() )
{ {
QRect pmRect = textRect; QRect pmRect = textRect;
pmRect.setTop( pmRect.bottom() - painter->fontMetrics().height() - 3 ); pmRect.setTop( pmRect.bottom() - painter->fontMetrics().height() + 3 );
pmRect.setRight( pmRect.left() + pmRect.height() ); pmRect.setRight( pmRect.left() + pmRect.height() );
// tDebug() << "DOING HEADPHONES RECT:" << pmRect; // tDebug() << "DOING HEADPHONES RECT:" << pmRect;
painter->drawPixmap( pmRect, pm.scaledToHeight( pmRect.height(), Qt::SmoothTransformation ) ); painter->drawPixmap( pmRect, pm.scaledToHeight( pmRect.height(), Qt::SmoothTransformation ) );
@@ -405,6 +405,7 @@ SourceDelegate::editorEvent ( QEvent* event, QAbstractItemModel* model, const QS
{ {
CollectionItem* colItem = qobject_cast< CollectionItem* >( index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() ); CollectionItem* colItem = qobject_cast< CollectionItem* >( index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() );
Q_ASSERT( colItem ); Q_ASSERT( colItem );
if ( !colItem->source().isNull() && !colItem->source()->currentTrack().isNull() && !colItem->source()->isLocal() ) if ( !colItem->source().isNull() && !colItem->source()->currentTrack().isNull() && !colItem->source()->isLocal() )
{ {
QMouseEvent* ev = static_cast< QMouseEvent* >( event ); QMouseEvent* ev = static_cast< QMouseEvent* >( event );