1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-30 19:00:12 +02:00

* Try using indexRowSizeHint for calculating view's height.

This commit is contained in:
Christian Muehlhaeuser
2013-09-07 19:30:16 +02:00
parent 3fb7b1ced0
commit 669f27716e

View File

@@ -799,12 +799,16 @@ TrackView::deleteSelectedItems()
void
TrackView::verifySize()
{
if ( !autoResize() || !m_proxyModel )
if ( !autoResize() || !m_proxyModel || !m_proxyModel->rowCount() )
return;
if ( m_proxyModel->rowCount() > 0 )
setFixedHeight( m_proxyModel->rowCount() * m_delegate->sizeHint( QStyleOptionViewItem(), m_proxyModel->index( 0, 0 ) ).height() +
contentsMargins().top() + contentsMargins().bottom() );
unsigned int height = 0;
for ( int i = 0; i < m_proxyModel->rowCount(); i++ )
{
height += indexRowSizeHint( m_proxyModel->index( i, 0 ) );
}
setFixedHeight( height + contentsMargins().top() + contentsMargins().bottom() );
}