VTK  9.3.1
vtkQtConnection.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 /*========================================================================
11  !!! WARNING for those who want to contribute code to this file.
12  !!! If you use a commercial edition of Qt, you can modify this code.
13  !!! If you use an open source version of Qt, you are free to modify
14  !!! and use this code within the guidelines of the GPL license.
15  !!! Unfortunately, you cannot contribute the changes back into this
16  !!! file. Doing so creates a conflict between the GPL and BSD-like VTK
17  !!! license.
18 =========================================================================*/
19 
20 // .SECTION Description
21 // vtkQtConnection is an internal class.
22 
23 #ifndef vtkQtConnection_h
24 #define vtkQtConnection_h
25 
26 #include "vtkCommand.h" // for event defines
27 #include <QObject>
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkObject;
31 class vtkCallbackCommand;
33 
34 // class for managing a single VTK/Qt connection
35 // not to be included in other projects
36 // only here for moc to process for vtkEventQtSlotConnect
37 class vtkQtConnection : public QObject
38 {
39  Q_OBJECT
40 
41 public:
42  // constructor
44 
45  // destructor, disconnect if necessary
46  ~vtkQtConnection() override;
47 
48  // print function
49  void PrintSelf(ostream& os, vtkIndent indent);
50 
51  // callback from VTK to emit signal
52  void Execute(vtkObject* caller, unsigned long event, void* client_data);
53 
54  // set the connection
55  void SetConnection(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
56  const char* slot, void* client_data, float priority = 0.0,
57  Qt::ConnectionType type = Qt::AutoConnection);
58 
59  // check if a connection matches input parameters
60  bool IsConnection(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
61  const char* slot, void* client_data);
62 
63  static void DoCallback(
64  vtkObject* vtk_obj, unsigned long event, void* client_data, void* call_data);
65 
66 Q_SIGNALS:
67  // the qt signal for moc to take care of
68  void EmitExecute(vtkObject*, unsigned long, void* client_data, void* call_data, vtkCommand*);
69 
70 protected Q_SLOTS:
71  void deleteConnection();
72 
73 protected: // NOLINT(readability-redundant-access-specifiers)
74  // the connection information
77  const QObject* QtObject;
78  void* ClientData;
79  unsigned long VTKEvent;
80  QString QtSlot;
82 
83 private:
85  void operator=(const vtkQtConnection&);
86 };
87 
88 VTK_ABI_NAMESPACE_END
89 #endif
90 // VTK-HeaderTest-Exclude: vtkQtConnection.h
abstract base class for most VTK objects
Definition: vtkObject.h:51
vtkCallbackCommand * Callback
vtkQtConnection(vtkEventQtSlotConnect *owner)
static void DoCallback(vtkObject *vtk_obj, unsigned long event, void *client_data, void *call_data)
void SetConnection(vtkObject *vtk_obj, unsigned long event, const QObject *qt_obj, const char *slot, void *client_data, float priority=0.0, Qt::ConnectionType type=Qt::AutoConnection)
void PrintSelf(ostream &os, vtkIndent indent)
Manage connections between VTK events and Qt slots.
unsigned long VTKEvent
const QObject * QtObject
superclass for callback/observer methods
Definition: vtkCommand.h:383
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:28
void EmitExecute(vtkObject *, unsigned long, void *client_data, void *call_data, vtkCommand *)
vtkEventQtSlotConnect * Owner
void Execute(vtkObject *caller, unsigned long event, void *client_data)
bool IsConnection(vtkObject *vtk_obj, unsigned long event, const QObject *qt_obj, const char *slot, void *client_data)
~vtkQtConnection() override
void deleteConnection()
vtkObject * VTKObject