1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

* Temporary fixes until PlaylistChartItemDelegate becomes a proper PlaylistItemDelegate.

This commit is contained in:
Christian Muehlhaeuser
2013-01-09 04:32:27 +01:00
parent ed151e1e3a
commit ebcda30c96
2 changed files with 6 additions and 8 deletions

View File

@@ -59,10 +59,11 @@ PlaylistChartItemDelegate::PlaylistChartItemDelegate( TrackView* parent, Playabl
m_bottomOption = QTextOption( Qt::AlignBottom ); m_bottomOption = QTextOption( Qt::AlignBottom );
m_bottomOption.setWrapMode( QTextOption::NoWrap ); m_bottomOption.setWrapMode( QTextOption::NoWrap );
connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );
connect( m_model, SIGNAL( modelReset() ), this, SLOT( modelChanged() ) ); connect( m_model, SIGNAL( modelReset() ), this, SLOT( modelChanged() ) );
if ( PlaylistView* plView = qobject_cast< PlaylistView* >( parent ) ) if ( PlaylistView* plView = qobject_cast< PlaylistView* >( parent ) )
connect( plView, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) ); connect( plView, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );
} }
@@ -91,11 +92,8 @@ PlaylistChartItemDelegate::sizeHint( const QStyleOptionViewItem& option, const Q
stretch = 2; stretch = 2;
} }
if ( index.isValid() ) int rowHeight = option.fontMetrics.height() + 8;
{ size.setHeight( rowHeight * stretch );
int rowHeight = option.fontMetrics.height() + 8;
size.setHeight( rowHeight * stretch );
}
return size; return size;
} }
@@ -241,7 +239,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
void void
PlaylistChartItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx ) PlaylistChartItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx )
{ {
emit updateRequest( idx ); emit updateIndex( idx );
} }

View File

@@ -43,7 +43,7 @@ public:
PlaylistChartItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 ); PlaylistChartItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 );
signals: signals:
void updateRequest( const QModelIndex& idx ); void updateIndex( const QModelIndex& idx );
protected: protected:
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;