VTK  9.1.0
QVTKApplication.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkActor.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// .NAME QVTKApplication - A superclass for QApplication using VTK.
16// .SECTION Description
17// This is a superclass for QApplication using VTK. It essentially redefined
18// x11EventFilter() in order to catch X11 ClientMessage coming from the
19// 3DConnexion driver.
20//
21// You don't have to inherit from QVTKApplication to be able to use VTK:
22// you can reimplement QVTKApplication(), ~QVTKApplication(), x11EventFilter(),
23// setDevice(), CreateDevice() in your own subclass of QApplication.
24// It you don't, VTK will work but without the 3Dconnexion device under X11.
25// In this case, QVTKApplication provides a model of implementation.
26
27// .SECTION See Also
28// vtkTDxQtUnixDevices
29
30#ifndef __QVTKApplication_h
31#define __QVTKApplication_h
32
33#include "QVTKWin32Header.h" // for VTKGUISUPPORTQT_EXPORT
34#include "vtkGUISupportQtModule.h" // For export macro
35#include "vtkTDxConfigure.h" // defines VTK_USE_TDX
36
37#include <QApplication>
38
39#ifdef VTK_USE_TDX
40class vtkTDxDevice;
41#if defined(Q_WS_X11) || defined(Q_OS_LINUX)
43#endif
44#endif
45
46class VTKGUISUPPORTQT_EXPORT QVTKApplication : public QApplication
47{
48 Q_OBJECT
49public:
50 // Description:
51 // Constructor.
52 QVTKApplication(int& Argc, char** Argv);
53
54 // Description:
55 // Destructor.
56 ~QVTKApplication() override;
57
58#if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
59 // Description:
60 // Intercept X11 events.
61 // Redefined from QApplication.
62 virtual bool x11EventFilter(XEvent* event);
63#endif
64
65#ifdef VTK_USE_TDX
66public Q_SLOTS:
67 // Description:
68 // Slot to receive signal CreateDevice coming from vtkTDxQtUnixDevices.
69 // It re-emit signal CreateDevice
70 // No-op if not X11 (ie Q_OS_LINUX and Q_WS_X11 is not defined).
71 void setDevice(vtkTDxDevice* device);
72
73Q_SIGNALS:
74 // Description:
75 // Signal for VTKWidget slots.
76 void CreateDevice(vtkTDxDevice* device);
77#endif
78
79protected:
80#if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
81 vtkTDxQtUnixDevices* Devices;
82#endif
83};
84
85#endif
~QVTKApplication() override
QVTKApplication(int &Argc, char **Argv)
Manage a list vtkTDXUnixDevice(s).