2
* Copyright 2015 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authors: Zsombor Egri <zsombor.egri@canonical.com>
19
#ifndef GESTUREDETECTOR_H
20
#define GESTUREDETECTOR_H
22
#include <QtCore/QObject>
23
#include <QtCore/QPointF>
24
#include <QtCore/QList>
27
* A simple gesture detection filter class that can be used in components to detect
28
* various gestures. Yet swipe from bottom up is the only gesture handled.
29
* It does not grab or consume the event from the environment, acts as a filter.
33
class GestureDetector : public QObject
43
explicit GestureDetector(QObject *parent = 0);
48
void setItemFilter(QObject *item);
49
void removeItemFilter(QObject *item);
51
bool handleTouchEvent(QObject *target, QTouchEvent *event);
54
void statusChanged(Status status);
56
void bottomUpSwipeDetected();
61
bool eventFilter(QObject *target, QEvent *event);
63
void setStatus(Status status);
66
QList<QObject*> m_filteredItems;
70
bool m_bottomUpSwipeDetected:1;
73
#endif // GESTUREDETECTOR_H