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