17 #include <QMouseEvent> 24 : QScrollArea( parent )
25 , mFilter( new ScrollAreaFilter( this, viewport() ) )
27 viewport()->installEventFilter( mFilter );
34 QScrollArea::wheelEvent( e );
39 mTimer.setSingleShot(
true );
45 return mTimer.isActive();
50 ScrollAreaFilter::ScrollAreaFilter(
QgsScrollArea *parent, QWidget *viewPort )
52 , mScrollAreaWidget( parent )
53 , mViewPort( viewPort )
56 bool ScrollAreaFilter::eventFilter( QObject *obj, QEvent *event )
58 switch ( event->type() )
60 case QEvent::ChildAdded:
63 QChildEvent *ce =
static_cast<QChildEvent *
>( event );
64 addChild( ce->child() );
68 case QEvent::ChildRemoved:
70 QChildEvent *ce =
static_cast<QChildEvent *
>( event );
71 removeChild( ce->child() );
77 if ( obj == mViewPort )
80 mScrollAreaWidget->scrollOccurred();
84 if ( mScrollAreaWidget->hasScrolled() )
96 return QObject::eventFilter( obj, event );
99 void ScrollAreaFilter::addChild( QObject *child )
101 if ( child && child->isWidgetType() )
103 child->installEventFilter(
this );
106 Q_FOREACH ( QObject *
c, child->children() )
113 void ScrollAreaFilter::removeChild( QObject *child )
115 if ( child && child->isWidgetType() )
117 child->removeEventFilter(
this );
120 Q_FOREACH ( QObject *
c, child->children() )
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c