VTK  9.4.20250113
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
21class QEvent;
22
23VTK_ABI_NAMESPACE_BEGIN
25
26// .NAME QVTKInteractorAdapter - A QEvent translator.
27// .SECTION Description
28// QVTKInteractorAdapter translates QEvents and send them to a
29// vtkRenderWindowInteractor.
30class VTKGUISUPPORTQT_EXPORT QVTKInteractorAdapter : public QObject
31{
32 Q_OBJECT
33public:
34 // Description:
35 // Constructor: takes QObject parent
36 QVTKInteractorAdapter(QObject* parent = nullptr);
37
38 // Description:
39 // Destructor
41
42 // Description:
43 // Enable/disable the touch event processing
45 bool GetEnableTouchEventProcessing() const { return this->EnableTouchProcessing; }
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
56
57protected:
61 static const double DevicePixelRatioTolerance;
62};
63
64VTK_ABI_NAMESPACE_END
65#endif
66// VTK-HeaderTest-Exclude: QVTKInteractorAdapter.h
void SetDevicePixelRatio(float ratio, vtkRenderWindowInteractor *iren=nullptr)
static const double DevicePixelRatioTolerance
QVTKInteractorAdapter(QObject *parent=nullptr)
~QVTKInteractorAdapter() override
bool GetEnableTouchEventProcessing() const
void SetEnableTouchEventProcessing(bool val)
bool ProcessEvent(QEvent *e, vtkRenderWindowInteractor *iren)
platform-independent render window interaction including picking and frame rate control.