VTK  9.3.20240419
QVTKInteractor.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 #ifndef Q_VTK_INTERACTOR_H
6 #define Q_VTK_INTERACTOR_H
7 
8 #include "QVTKWin32Header.h"
9 #include "vtkGUISupportQtModule.h" // For export macro
10 #include <QtCore/QObject>
11 #include <vtkCommand.h>
13 
14 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
15 VTK_ABI_NAMESPACE_BEGIN
16 #if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
17 class vtkTDxWinDevice;
18 #endif
19 #if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
20 class vtkTDxMacDevice;
21 #endif
22 #if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
23 class vtkTDxDevice;
24 class vtkTDxUnixDevice;
25 #endif
26 
28 
37 class VTKGUISUPPORTQT_EXPORT QVTKInteractor : public vtkRenderWindowInteractor
38 {
39 public:
40  static QVTKInteractor* New();
42 
48  {
49  ContextMenuEvent = vtkCommand::UserEvent + 100,
53  DropEvent
54  };
55 
60  void TerminateApp() override;
61 
66  void Start() override;
67  void Initialize() override;
68 
72  virtual void StartListening();
73 
77  virtual void StopListening();
78 
82  virtual void TimerEvent(int timerId);
83 
84 #if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
85  virtual vtkTDxUnixDevice* GetDevice();
86  virtual void SetDevice(vtkTDxDevice* device);
87 #endif
88 
89 protected:
90  // constructor
92  // destructor
93  ~QVTKInteractor() override;
94 
95  // create a Qt Timer
96  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
97  // destroy a Qt Timer
98  int InternalDestroyTimer(int platformTimerId) override;
99 #if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
100  vtkTDxWinDevice* Device;
101 #endif
102 #if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
103  vtkTDxMacDevice* Device;
104 #endif
105 #if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
106  vtkTDxUnixDevice* Device;
107 #endif
108 
109 private:
110  QVTKInteractorInternal* Internal;
111 
112  QVTKInteractor(const QVTKInteractor&) = delete;
113  void operator=(const QVTKInteractor&) = delete;
114 };
115 
116 VTK_ABI_NAMESPACE_END
117 #endif
118 // VTK-HeaderTest-Exclude: QVTKInteractor.h
an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
void Initialize() override
Prepare for handling events and set the Enabled flag to true.
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
Internal methods for creating and destroying timers that must be implemented by subclasses.
~QVTKInteractor() override
virtual void StopListening()
Stop listening events on 3DConnexion device.
virtual void TimerEvent(int timerId)
timer event slot
vtkCustomEvents
Enum for additional event types supported.
int InternalDestroyTimer(int platformTimerId) override
Internal methods for creating and destroying timers that must be implemented by subclasses.
void Start() override
Overloaded start method does nothing.
void TerminateApp() override
Overloaded terminate app, which does nothing in Qt.
virtual void StartListening()
Start listening events on 3DConnexion device.
static QVTKInteractor * New()
platform-independent render window interaction including picking and frame rate control.