QskScrollBox::scrollOffset reintroduced
This commit is contained in:
parent
3f0aaae1a1
commit
1dd3127f9f
@ -400,15 +400,20 @@ void QskScrollBox::gestureEvent( QskGestureEvent* event )
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
|
||||
void QskScrollBox::wheelEvent( QWheelEvent* event )
|
||||
QPointF QskScrollBox::scrollOffset( const QWheelEvent* event ) const
|
||||
{
|
||||
const auto pos = qskWheelPosition( event );
|
||||
if ( viewContentsRect().contains( pos ) )
|
||||
{
|
||||
const auto offset = qskScrollIncrement( event );
|
||||
if ( !offset.isNull() )
|
||||
setScrollPos( m_data->scrollPos - offset );
|
||||
}
|
||||
return qskScrollIncrement( event );
|
||||
|
||||
return QPointF();
|
||||
}
|
||||
|
||||
void QskScrollBox::wheelEvent( QWheelEvent* event )
|
||||
{
|
||||
const auto offset = scrollOffset( event );
|
||||
if ( !offset.isNull() )
|
||||
setScrollPos( m_data->scrollPos - offset );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -68,6 +68,7 @@ class QSK_EXPORT QskScrollBox : public QskControl
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent( QWheelEvent* ) override;
|
||||
virtual QPointF scrollOffset( const QWheelEvent* ) const;
|
||||
#endif
|
||||
|
||||
bool gestureFilter( QQuickItem*, QEvent* ) override;
|
||||
|
@ -209,7 +209,7 @@ void QskScrollView::mouseReleaseEvent( QMouseEvent* event )
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
|
||||
void QskScrollView::wheelEvent( QWheelEvent* event )
|
||||
QPointF QskScrollView::scrollOffset( const QWheelEvent* event ) const
|
||||
{
|
||||
QPointF offset;
|
||||
|
||||
@ -236,13 +236,12 @@ void QskScrollView::wheelEvent( QWheelEvent* event )
|
||||
}
|
||||
offset.setX( dx );
|
||||
}
|
||||
else if ( viewContentsRect().contains( pos ) )
|
||||
else
|
||||
{
|
||||
offset = qskScrollIncrement( event );
|
||||
offset = Inherited::scrollOffset( event );
|
||||
}
|
||||
|
||||
if ( !offset.isNull() )
|
||||
setScrollPos( scrollPos() - offset );
|
||||
return offset;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ class QSK_EXPORT QskScrollView : public QskScrollBox
|
||||
void mouseReleaseEvent( QMouseEvent* ) override;
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent( QWheelEvent* ) override;
|
||||
QPointF scrollOffset( const QWheelEvent* ) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user