NDEVR
API Documentation
ScrollGesture

Handles scrolling or flicking within the application. More...

Public Member Functions

 ScrollGesture (QAbstractScrollArea *target)
 Constructs a ScrollGesture attached to the given scroll area.
bool eventFilter (QObject *, QEvent *) override
 Filters events for the target object to intercept mouse gestures for scrolling.
bool handleMouseMove (QEvent *event, QPoint location)
 Handles the mouse move event to continue tracking a scroll gesture.
bool handleMousePress (QEvent *event, QPoint location)
 Handles the mouse press event to begin tracking a potential scroll gesture.
bool handleMouseRelease (QEvent *event, QPoint location)
 Handles the mouse release event to finalize a scroll gesture and apply flick momentum.
void setAcceptMouseClick (QWidget *target)
 Configures a widget to accept mouse click events that originate from the scroll gesture.
void setScrollOffset (QPoint point)
 Sets the current scroll offset of the target scroll area.
void setThreshold (int threshold)
 Sets the minimum pixel distance required before a drag is recognized as a scroll gesture.
int threshold () const
 Returns the minimum pixel distance required before a drag is recognized as a scroll gesture.

Detailed Description

Handles scrolling or flicking within the application.


Provides kinetic scrolling behavior for QAbstractScrollArea widgets by tracking mouse press, move, and release events and applying momentum-based flick gestures.

Definition at line 48 of file ScrollGesture.h.

Constructor & Destructor Documentation

◆ ScrollGesture()

ScrollGesture::ScrollGesture ( QAbstractScrollArea * target)

Constructs a ScrollGesture attached to the given scroll area.

Parameters
[in]targetThe scroll area widget that will receive scroll gesture behavior.

References ScrollGesture().

Referenced by ScrollGesture().

Member Function Documentation

◆ eventFilter()

bool ScrollGesture::eventFilter ( QObject * ,
QEvent *  )
override

Filters events for the target object to intercept mouse gestures for scrolling.

Parameters
[in]objectThe object receiving the event.
[in]eventThe event to filter.
Returns
True if the event was handled by this gesture filter.

◆ handleMouseMove()

bool ScrollGesture::handleMouseMove ( QEvent * event,
QPoint location )

Handles the mouse move event to continue tracking a scroll gesture.

Parameters
[in]eventThe mouse move event.
[in]locationThe current position of the cursor in widget coordinates.
Returns
True if the event was handled.

◆ handleMousePress()

bool ScrollGesture::handleMousePress ( QEvent * event,
QPoint location )

Handles the mouse press event to begin tracking a potential scroll gesture.

Parameters
[in]eventThe mouse press event.
[in]locationThe position of the press in widget coordinates.
Returns
True if the event was handled.

◆ handleMouseRelease()

bool ScrollGesture::handleMouseRelease ( QEvent * event,
QPoint location )

Handles the mouse release event to finalize a scroll gesture and apply flick momentum.

Parameters
[in]eventThe mouse release event.
[in]locationThe position of the release in widget coordinates.
Returns
True if the event was handled.

◆ setAcceptMouseClick()

void ScrollGesture::setAcceptMouseClick ( QWidget * target)

Configures a widget to accept mouse click events that originate from the scroll gesture.

Parameters
[in]targetThe widget that should accept mouse click events.

◆ setScrollOffset()

void ScrollGesture::setScrollOffset ( QPoint point)

Sets the current scroll offset of the target scroll area.

Parameters
[in]pointThe scroll offset to apply.

◆ setThreshold()

void ScrollGesture::setThreshold ( int threshold)

Sets the minimum pixel distance required before a drag is recognized as a scroll gesture.

Parameters
[in]thresholdThe distance threshold in pixels.

References threshold().

◆ threshold()

int ScrollGesture::threshold ( ) const

Returns the minimum pixel distance required before a drag is recognized as a scroll gesture.

Returns
The distance threshold in pixels.

Referenced by setThreshold().


The documentation for this class was generated from the following file: