VTK
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 QVTKWidget
29 
30 #ifndef __QVTKApplication_h
31 #define __QVTKApplication_h
32 
33 
34 #include "vtkGUISupportQtModule.h" // For export macro
35 #include "QVTKWin32Header.h" // for VTKGUISUPPORTQT_EXPORT
36 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
37 
38 #include <QApplication>
39 
40 #ifdef VTK_USE_TDX
41 class vtkTDxDevice;
42  #ifdef Q_WS_X11
44  #endif
45 #endif
46 
47 class VTKGUISUPPORTQT_EXPORT QVTKApplication : public QApplication
48 {
49  Q_OBJECT
50 public:
51  // Description:
52  // Constructor.
53  QVTKApplication(int &Argc, char **Argv);
54 
55  // Description:
56  // Destructor.
57  ~QVTKApplication();
58 
59 #if defined(VTK_USE_TDX) && defined(Q_WS_X11)
60  // Description:
61  // Intercept X11 events.
62  // Redefined from QApplication.
63  virtual bool x11EventFilter(XEvent *event);
64 #endif
65 
66 #ifdef VTK_USE_TDX
67 public Q_SLOTS:
68 // Description:
69 // Slot to receive signal CreateDevice coming from vtkTDxQtUnixDevices.
70 // It re-emit signal CreateDevice (to QVTKWidget slots)
71 // No-op if not X11 (ie Q_WS_X11 is not defined).
72 void setDevice(vtkTDxDevice *device);
73 
74 Q_SIGNALS:
75 // Description:
76 // Signal for VTKWidget slots.
77  void CreateDevice(vtkTDxDevice *device);
78 #endif
79 
80 protected:
81 #if defined(VTK_USE_TDX) && defined(Q_WS_X11)
82  vtkTDxQtUnixDevices *Devices;
83 #endif
84 };
85 
86 #endif
Manage a list vtkTDXUnixDevice(s).
API to access a 3DConnexion input device.
Definition: vtkTDxDevice.h:37