1// Copyright (C) 2023 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 <QtGraphs/qabstract3dinputhandler.h>
8
9QT_BEGIN_NAMESPACE
10
11class Q3DInputHandlerPrivate;
12
13class Q_GRAPHS_EXPORT Q3DInputHandler : public QAbstract3DInputHandler
14{
15 Q_OBJECT
16 Q_DECLARE_PRIVATE(Q3DInputHandler)
17 Q_PROPERTY(bool rotationEnabled READ isRotationEnabled WRITE setRotationEnabled NOTIFY rotationEnabledChanged)
18 Q_PROPERTY(bool zoomEnabled READ isZoomEnabled WRITE setZoomEnabled NOTIFY zoomEnabledChanged)
19 Q_PROPERTY(bool selectionEnabled READ isSelectionEnabled WRITE setSelectionEnabled NOTIFY selectionEnabledChanged)
20 Q_PROPERTY(bool zoomAtTargetEnabled READ isZoomAtTargetEnabled WRITE setZoomAtTargetEnabled NOTIFY zoomAtTargetEnabledChanged)
21
22protected:
23 explicit Q3DInputHandler(Q3DInputHandlerPrivate *d, QObject *parent = nullptr);
24
25public:
26 explicit Q3DInputHandler(QObject *parent = nullptr);
27 virtual ~Q3DInputHandler();
28
29 void setRotationEnabled(bool enable);
30 bool isRotationEnabled() const;
31 void setZoomEnabled(bool enable);
32 bool isZoomEnabled() const;
33 void setSelectionEnabled(bool enable);
34 bool isSelectionEnabled() const;
35 void setZoomAtTargetEnabled(bool enable);
36 bool isZoomAtTargetEnabled() const;
37
38 // Input event listeners
39 void mousePressEvent(QMouseEvent *event, const QPoint &mousePos) override;
40 void mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos) override;
41 void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos) override;
42#if QT_CONFIG(wheelevent)
43 void wheelEvent(QWheelEvent *event) override;
44#endif
45
46Q_SIGNALS:
47 void rotationEnabledChanged(bool enable);
48 void zoomEnabledChanged(bool enable);
49 void selectionEnabledChanged(bool enable);
50 void zoomAtTargetEnabledChanged(bool enable);
51
52private:
53 Q_DISABLE_COPY(Q3DInputHandler)
54};
55
56QT_END_NAMESPACE
57
58#endif
59

source code of qtgraphs/src/graphs/input/q3dinputhandler.h