diff --git a/kstyle/animations/breezeheaderviewdata.cpp b/kstyle/animations/breezeheaderviewdata.cpp index 3972f2c7..bf4bad50 100644 --- a/kstyle/animations/breezeheaderviewdata.cpp +++ b/kstyle/animations/breezeheaderviewdata.cpp @@ -47,6 +47,7 @@ #include "breezeheaderviewdata.moc" #include +#include namespace Breeze { @@ -56,8 +57,6 @@ namespace Breeze AnimationData( parent, target ) { - target->installEventFilter( this ); - _current._animation = new Animation( duration, this ); setupAnimation( currentIndexAnimation(), "currentOpacity" ); currentIndexAnimation().data()->setDirection( Animation::Forward ); @@ -77,7 +76,7 @@ namespace Breeze const QHeaderView* local( qobject_cast( target().data() ) ); if( !local ) return false; - int index( local->logicalIndexAt( position ) ); + const int index( local->logicalIndexAt( position ) ); if( index < 0 ) return false; if( hovered ) @@ -146,4 +145,29 @@ namespace Breeze } + + //__________________________________________________________ + void HeaderViewData::setDirty( void ) const + { + QHeaderView* header = qobject_cast( target().data() ); + if( !header ) return; + + // get first and last index, sorted + const int lastIndex( qMax( previousIndex(), currentIndex() ) ); + if( lastIndex < 0 ) return; + + int firstIndex( qMin( previousIndex(), currentIndex() ) ); + if( firstIndex < 0 ) firstIndex = lastIndex; + + // find relevant rectangle to be updated, in viewport coordinate + QWidget* viewport( header->viewport() ); + const int left = header->sectionViewportPosition( firstIndex ); + const int right = header->sectionViewportPosition( lastIndex ) + header->sectionSize( lastIndex ); + + // trigger update + if( header->orientation() == Qt::Horizontal ) viewport->update( left, 0, right-left, header->height() ); + else viewport->update( 0, left, header->width(), right-left ); + + } + } diff --git a/kstyle/animations/breezeheaderviewdata.h b/kstyle/animations/breezeheaderviewdata.h index 6bb54ff0..072a6d36 100644 --- a/kstyle/animations/breezeheaderviewdata.h +++ b/kstyle/animations/breezeheaderviewdata.h @@ -124,7 +124,7 @@ namespace Breeze protected: //* dirty - inline virtual void setDirty( void ) const; + virtual void setDirty( void ) const; private: @@ -152,20 +152,6 @@ namespace Breeze }; - - //__________________________________________________________ - void HeaderViewData::setDirty( void ) const - { - if( QHeaderView* header = qobject_cast( target().data() ) ) - { - const int firstIndex( qMin( previousIndex(), currentIndex() ) ); - const int lastIndex( qMax( previousIndex(), currentIndex() ) ); - if( firstIndex >= 0 ) header->headerDataChanged( header->orientation(), firstIndex, lastIndex ); - else if( lastIndex >= 0 ) header->headerDataChanged( header->orientation(), lastIndex, lastIndex ); - } - } - - } #endif