1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-30 01:00:13 +02:00

* Style cleanup.

This commit is contained in:
Christian Muehlhaeuser
2012-06-26 05:01:18 +02:00
parent cd7c64ac0a
commit 23c2c77869
3 changed files with 19 additions and 14 deletions

View File

@@ -26,8 +26,10 @@
#include <QListView> #include <QListView>
#define ROW_HEIGHT 20 #define ROW_HEIGHT 20
#define ICON_PADDING 1 #define ICON_PADDING 2
#define PADDING 2 #define PADDING 2
JobStatusDelegate::JobStatusDelegate( QObject* parent ) JobStatusDelegate::JobStatusDelegate( QObject* parent )
: QStyledItemDelegate ( parent ) : QStyledItemDelegate ( parent )
, m_parentView( qobject_cast< QListView* >( parent ) ) , m_parentView( qobject_cast< QListView* >( parent ) )
@@ -35,6 +37,7 @@ JobStatusDelegate::JobStatusDelegate( QObject* parent )
Q_ASSERT( m_parentView ); Q_ASSERT( m_parentView );
} }
JobStatusDelegate::~JobStatusDelegate() JobStatusDelegate::~JobStatusDelegate()
{ {
@@ -84,9 +87,11 @@ JobStatusDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
mainText = fm.elidedText( mainText, Qt::ElideRight, mainW ); mainText = fm.elidedText( mainText, Qt::ElideRight, mainW );
else else
to.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere ); to.setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere );
painter->drawText( QRect( iconRect.right() + 2*PADDING, PADDING + opt.rect.y(), mainW, opt.rect.height() - 2*PADDING ), mainText, to );
painter->drawText( QRect( iconRect.right() + 4 * PADDING, PADDING + opt.rect.y(), mainW, opt.rect.height() - 2 * PADDING ), mainText, to );
} }
QSize QSize
JobStatusDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const JobStatusDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ {

View File

@@ -105,7 +105,6 @@ JobStatusView::customDelegateJobInserted( int row, JobStatusItem* item )
if ( !item ) if ( !item )
return; return;
tLog() << Q_FUNC_INFO << "telling item to create delegate";
item->createDelegate( m_view ); item->createDelegate( m_view );
tLog() << Q_FUNC_INFO << "item delegate is" << item->customDelegate(); tLog() << Q_FUNC_INFO << "item delegate is" << item->customDelegate();
m_view->setItemDelegateForRow( row, item->customDelegate() ); m_view->setItemDelegateForRow( row, item->customDelegate() );

View File

@@ -102,6 +102,7 @@ PlaylistItem::IDValue() const
return m_playlist->createdOn(); return m_playlist->createdOn();
} }
bool bool
PlaylistItem::isBeingPlayed() const PlaylistItem::isBeingPlayed() const
{ {