1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-18 23:09:42 +01:00

Small performance improvements in TrackItemDelegate.

This commit is contained in:
Christian Muehlhaeuser 2015-04-08 03:06:11 +02:00
parent da0d585d53
commit 6aa22826ae

View File

@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2014-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -61,7 +61,7 @@ TrackItemDelegate::TrackItemDelegate( DisplayMode mode, TrackView* parent, Playa
QSize
TrackItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QSize size = QStyledItemDelegate::sizeHint( option, index );
QSize size;
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
Q_ASSERT( item );
@ -90,6 +90,9 @@ TrackItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInd
void
TrackItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
if ( m_view->header()->visualIndex( index.column() ) > 0 )
return;
painter->setRenderHint( QPainter::TextAntialiasing );
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
@ -98,9 +101,6 @@ TrackItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
QStyleOptionViewItemV4 opt = option;
prepareStyleOption( &opt, index, item );
if ( m_view->header()->visualIndex( index.column() ) > 0 )
return;
if ( item->source() )
{
drawSource( painter, opt, index, opt.rect, item );