@@ -1,59 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "FloatingFlickableHelper.h"
18−
19−#include <QCoreApplication>
20−#include <QMouseEvent>
21−#include <QQuickItem>
22−
23−FloatingFlickableHelper::FloatingFlickableHelper(QObject *parent)
24− : QObject(parent)
25− , m_mousePressed(false)
26−{
27−}
28−
29−void FloatingFlickableHelper::onDragAreaTouchPosChanged(QQuickItem *flickable, const QPointF touchPosition)
30−{
31− if (m_mousePressed) {
32− QMouseEvent mouseEvent(QEvent::MouseMove,
33− QPointF(touchPosition.x(), touchPosition.y()),
34− Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
35−
36− QCoreApplication::sendEvent(flickable, &mouseEvent);
37−
38− }
39−}
40−
41−void FloatingFlickableHelper::onDragAreaDraggingChanged(QQuickItem *flickable, bool dragging, const QPointF touchPosition)
42−{
43− if (dragging && !m_mousePressed) {
44− QMouseEvent mouseEvent(QEvent::MouseButtonPress,
45− QPointF(touchPosition.x(), touchPosition.y()),
46− Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
47−
48− QCoreApplication::sendEvent(flickable, &mouseEvent);
49− m_mousePressed = true;
50−
51− } else if (!dragging && m_mousePressed) {
52− QMouseEvent mouseEvent(QEvent::MouseButtonRelease,
53− QPointF(touchPosition.x(), touchPosition.y()),
54− Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
55−
56− QCoreApplication::sendEvent(flickable, &mouseEvent);
57− m_mousePressed = false;
58− }
59−}