VTK  9.1.0
QVTKInteractorAdapter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: QVTKInteractorAdapter.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15
16/*=========================================================================
17
18 Copyright 2004 Sandia Corporation.
19 Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
20 license for use of this work by or on behalf of the
21 U.S. Government. Redistribution and use in source and binary forms, with
22 or without modification, are permitted provided that this Notice and any
23 statement of authorship are reproduced on all copies.
24
25=========================================================================*/
26
27/*========================================================================
28 For general information about using VTK and Qt, see:
29 http://www.trolltech.com/products/3rdparty/vtksupport.html
30=========================================================================*/
31
32// .NAME QVTKInteractorAdapter - Handle Qt events.
33// .SECTION Description
34// QVTKInteractor handles relaying Qt events to VTK.
35
36#ifndef Q_VTK_INTERACTOR_ADAPTER_H
37#define Q_VTK_INTERACTOR_ADAPTER_H
38
39#include "QVTKWin32Header.h"
40#include "vtkGUISupportQtModule.h" // For export macro
41#include <QtCore/QObject>
42
44class QEvent;
45
46// .NAME QVTKInteractorAdapter - A QEvent translator.
47// .SECTION Description
48// QVTKInteractorAdapter translates QEvents and send them to a
49// vtkRenderWindowInteractor.
50class VTKGUISUPPORTQT_EXPORT QVTKInteractorAdapter : public QObject
51{
52 Q_OBJECT
53public:
54 // Description:
55 // Constructor: takes QObject parent
56 QVTKInteractorAdapter(QObject* parent = nullptr);
57
58 // Description:
59 // Destructor
61
62 // Description:
63 // Set the device pixel ratio, this defaults to 1.0, but in Qt 5 can be != 1.0.
64 void SetDevicePixelRatio(float ratio, vtkRenderWindowInteractor* iren = nullptr);
65 float GetDevicePixelRatio() { return this->DevicePixelRatio; }
66
67 // Description:
68 // Process a QEvent and send it to the interactor
69 // returns whether the event was recognized and processed
71
72protected:
75 static const double DevicePixelRatioTolerance;
76};
77
78#endif
void SetDevicePixelRatio(float ratio, vtkRenderWindowInteractor *iren=nullptr)
static const double DevicePixelRatioTolerance
QVTKInteractorAdapter(QObject *parent=nullptr)
~QVTKInteractorAdapter() override
bool ProcessEvent(QEvent *e, vtkRenderWindowInteractor *iren)
platform-independent render window interaction including picking and frame rate control.