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

fix off-by-one painting bug in dropmenu

This commit is contained in:
Michael Zanetti
2011-08-23 08:36:31 +02:00
parent a7d1275e52
commit f0a05acf01

View File

@@ -174,7 +174,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
} }
else if ( type == SourcesModel::StaticPlaylist || type == SourcesModel::CategoryAdd ) else if ( type == SourcesModel::StaticPlaylist || type == SourcesModel::CategoryAdd )
{ {
if ( !( m_expandedMap.contains( index) && m_expandedMap.value( index )->partlyExpanded() && dropTypeCount( item ) > 0 ) ) if ( !m_expandedMap.contains( index) )
{ {
QStyledItemDelegate::paint( painter, option, index ); QStyledItemDelegate::paint( painter, option, index );
return; return;
@@ -182,9 +182,12 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
// Let Qt paint the original item. We add our stuff after it // Let Qt paint the original item. We add our stuff after it
QStyleOptionViewItem o = option; QStyleOptionViewItem o = option;
o.rect.adjust( 0, 0, 0, - option.rect.height() + m_expandedMap.value( index )->originalSize().height() + 2 ); o.rect.adjust( 0, 0, 0, - option.rect.height() + m_expandedMap.value( index )->originalSize().height() );
QStyledItemDelegate::paint( painter, o, index ); QStyledItemDelegate::paint( painter, o, index );
if ( !( m_expandedMap.value( index )->partlyExpanded() && dropTypeCount( item ) > 0 ) )
return;
painter->save(); painter->save();
// Get whole rect for the menu // Get whole rect for the menu