VTK  9.3.20240422
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
29VTK_ABI_NAMESPACE_BEGIN
30class vtkObject;
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
37class vtkQtConnection : public QObject
38{
39 Q_OBJECT
40
41public:
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
66Q_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
70protected Q_SLOTS:
72
73protected: // NOLINT(readability-redundant-access-specifiers)
74 // the connection information
77 const QObject* QtObject;
79 unsigned long VTKEvent;
80 QString QtSlot;
82
83private:
85 void operator=(const vtkQtConnection&);
86};
87
88VTK_ABI_NAMESPACE_END
89#endif
90// VTK-HeaderTest-Exclude: vtkQtConnection.h
supports function callbacks
superclass for callback/observer methods
Definition vtkCommand.h:384
Manage connections between VTK events and Qt slots.
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
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 deleteConnection()
vtkQtConnection(vtkEventQtSlotConnect *owner)
void Execute(vtkObject *caller, unsigned long event, void *client_data)
const QObject * QtObject
void PrintSelf(ostream &os, vtkIndent indent)
void EmitExecute(vtkObject *, unsigned long, void *client_data, void *call_data, vtkCommand *)
static void DoCallback(vtkObject *vtk_obj, unsigned long event, void *client_data, void *call_data)
vtkCallbackCommand * Callback
unsigned long VTKEvent
vtkEventQtSlotConnect * Owner
vtkObject * VTKObject
~vtkQtConnection() override
bool IsConnection(vtkObject *vtk_obj, unsigned long event, const QObject *qt_obj, const char *slot, void *client_data)