VTK  9.7.1
QVTKInteractorAdapter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2004 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4 
5 /*========================================================================
6  For general information about using VTK and Qt, see:
7  http://www.trolltech.com/products/3rdparty/vtksupport.html
8 =========================================================================*/
9 
10 // .NAME QVTKInteractorAdapter - Handle Qt events.
11 // .SECTION Description
12 // QVTKInteractor handles relaying Qt events to VTK.
13 
14 #ifndef Q_VTK_INTERACTOR_ADAPTER_H
15 #define Q_VTK_INTERACTOR_ADAPTER_H
16 
17 #include "QVTKWin32Header.h"
18 #include "vtkGUISupportQtModule.h" // For export macro
19 #include <QtCore/QObject>
20 
21 class QEvent;
22 
23 VTK_ABI_NAMESPACE_BEGIN
25 
26 // .NAME QVTKInteractorAdapter - A QEvent translator.
27 // .SECTION Description
28 // QVTKInteractorAdapter translates QEvents and send them to a
29 // vtkRenderWindowInteractor.
30 class VTKGUISUPPORTQT_EXPORT QVTKInteractorAdapter : public QObject
31 {
32  Q_OBJECT
33 public:
34  // Description:
35  // Constructor: takes QObject parent
36  QVTKInteractorAdapter(QObject* parent = nullptr);
37 
38  // Description:
39  // Destructor
40  ~QVTKInteractorAdapter() override;
41 
42  // Description:
43  // Enable/disable the touch event processing
44  void SetEnableTouchEventProcessing(bool val);
45  bool GetEnableTouchEventProcessing() const { return this->EnableTouchEventProcessing; }
46 
47  // Description:
48  // Set the device pixel ratio, this defaults to 1.0, but in Qt 5 can be != 1.0.
49  void SetDevicePixelRatio(float ratio, vtkRenderWindowInteractor* iren = nullptr);
50  float GetDevicePixelRatio() { return this->DevicePixelRatio; }
51 
52  // Description:
53  // Process a QEvent and send it to the interactor
54  // returns whether the event was recognized and processed
55  virtual bool ProcessEvent(QEvent* e, vtkRenderWindowInteractor* iren);
56 
57 protected:
59  bool EnableTouchEventProcessing = true;
61  static const double DevicePixelRatioTolerance;
62 };
63 
64 VTK_ABI_NAMESPACE_END
65 #endif
66 // VTK-HeaderTest-Exclude: QVTKInteractorAdapter.h
bool GetEnableTouchEventProcessing() const
platform-independent render window interaction including picking and frame rate control.
static const double DevicePixelRatioTolerance