1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef Q3DINPUTHANDLER_H
5#define Q3DINPUTHANDLER_H
6
7#include <QtDataVisualization/qabstract3dinputhandler.h>
8
9QT_BEGIN_NAMESPACE
10
11class Q3DInputHandlerPrivate;
12
13class Q_DATAVISUALIZATION_EXPORT Q3DInputHandler : public QAbstract3DInputHandler
14{
15 Q_OBJECT
16 Q_PROPERTY(bool rotationEnabled READ isRotationEnabled WRITE setRotationEnabled NOTIFY rotationEnabledChanged)
17 Q_PROPERTY(bool zoomEnabled READ isZoomEnabled WRITE setZoomEnabled NOTIFY zoomEnabledChanged)
18 Q_PROPERTY(bool selectionEnabled READ isSelectionEnabled WRITE setSelectionEnabled NOTIFY selectionEnabledChanged)
19 Q_PROPERTY(bool zoomAtTargetEnabled READ isZoomAtTargetEnabled WRITE setZoomAtTargetEnabled NOTIFY zoomAtTargetEnabledChanged)
20
21public:
22 explicit Q3DInputHandler(QObject *parent = nullptr);
23 virtual ~Q3DInputHandler();
24
25 void setRotationEnabled(bool enable);
26 bool isRotationEnabled() const;
27 void setZoomEnabled(bool enable);
28 bool isZoomEnabled() const;
29 void setSelectionEnabled(bool enable);
30 bool isSelectionEnabled() const;
31 void setZoomAtTargetEnabled(bool enable);
32 bool isZoomAtTargetEnabled() const;
33
34 // Input event listeners
35 void mousePressEvent(QMouseEvent *event, const QPoint &mousePos) override;
36 void mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos) override;
37 void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos) override;
38#if QT_CONFIG(wheelevent)
39 void wheelEvent(QWheelEvent *event) override;
40#endif
41
42Q_SIGNALS:
43 void rotationEnabledChanged(bool enable);
44 void zoomEnabledChanged(bool enable);
45 void selectionEnabledChanged(bool enable);
46 void zoomAtTargetEnabledChanged(bool enable);
47
48private:
49 Q_DISABLE_COPY(Q3DInputHandler)
50
51 QScopedPointer<Q3DInputHandlerPrivate> d_ptr;
52};
53
54QT_END_NAMESPACE
55
56#endif
57

source code of qtdatavis3d/src/datavisualization/input/q3dinputhandler.h