aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/componentcore/navigation2d.h
blob: 9b33320d9bde4e5f598e17c63412564e87835640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once

#include <QObject>

QT_FORWARD_DECLARE_CLASS(QGestureEvent)
QT_FORWARD_DECLARE_CLASS(QScrollBar)
QT_FORWARD_DECLARE_CLASS(QWheelEvent)

namespace QmlDesigner {

class Navigation2dFilter : public QObject
{
    Q_OBJECT

signals:
    void zoomChanged(double scale, const QPointF &pos);
    void panChanged(const QPointF &direction);

    void zoomIn();
    void zoomOut();

public:
    static void scroll(const QPointF &direction, QScrollBar *sbx, QScrollBar *sby);

    Navigation2dFilter(QWidget *parent);

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;

private:
    bool gestureEvent(QGestureEvent *event);
    bool wheelEvent(QWheelEvent *event);
};

} // namespace QmlDesigner