NDEVR
API Documentation
ScrollGesture.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: ScrollGesture
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <QObject>
35class QMouseEvent;
36class QPoint;
37class QAbstractScrollArea;
38
39namespace NDEVR
40{
41 class FlickableTicker;
42 class ScrollGesturePrivate;
48 class NDEVR_WIDGETS_API ScrollGesture : public QObject
49 {
50 public:
55 ScrollGesture(QAbstractScrollArea* target);
56 virtual ~ScrollGesture();
63 bool eventFilter(QObject *, QEvent *) override;
73 int threshold() const;
78 void setAcceptMouseClick(QWidget *target);
85 bool handleMousePress(QEvent* event, QPoint location);
92 bool handleMouseMove(QEvent* event, QPoint location);
99 bool handleMouseRelease(QEvent* event, QPoint location);
104 void setScrollOffset(QPoint point);
105 private:
109 void tick();
110
111 private:
112 ScrollGesturePrivate *d;
113 QAbstractScrollArea* m_widget;
114 friend class FlickableTicker;
115 };
116}
ScrollGesture(QAbstractScrollArea *target)
Constructs a ScrollGesture attached to the given scroll area.
int threshold() const
Returns the minimum pixel distance required before a drag is recognized as a scroll gesture.
bool handleMouseMove(QEvent *event, QPoint location)
Handles the mouse move event to continue tracking a scroll gesture.
bool eventFilter(QObject *, QEvent *) override
Filters events for the target object to intercept mouse gestures for scrolling.
void setScrollOffset(QPoint point)
Sets the current scroll offset of the target scroll area.
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 setThreshold(int threshold)
Sets the minimum pixel distance required before a drag is recognized as a scroll gesture.
The primary namespace for the NDEVR SDK.