VTK  9.0.1
vtkQtConnection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Copyright 2004 Sandia Corporation.
4  Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
5  license for use of this work by or on behalf of the
6  U.S. Government. Redistribution and use in source and binary forms, with
7  or without modification, are permitted provided that this Notice and any
8  statement of authorship are reproduced on all copies.
9 
10 =========================================================================*/
11 
12 /*========================================================================
13  For general information about using VTK and Qt, see:
14  http://www.trolltech.com/products/3rdparty/vtksupport.html
15 =========================================================================*/
16 
17 /*========================================================================
18  !!! WARNING for those who want to contribute code to this file.
19  !!! If you use a commercial edition of Qt, you can modify this code.
20  !!! If you use an open source version of Qt, you are free to modify
21  !!! and use this code within the guidelines of the GPL license.
22  !!! Unfortunately, you cannot contribute the changes back into this
23  !!! file. Doing so creates a conflict between the GPL and BSD-like VTK
24  !!! license.
25 =========================================================================*/
26 
27 // .SECTION Description
28 // vtkQtConnection is an internal class.
29 
30 #ifndef vtkQtConnection_h
31 #define vtkQtConnection_h
32 
33 #include "vtkCommand.h" // for event defines
34 #include <QObject>
35 
36 class vtkObject;
37 class vtkCallbackCommand;
39 
40 // class for managing a single VTK/Qt connection
41 // not to be included in other projects
42 // only here for moc to process for vtkEventQtSlotConnect
43 class vtkQtConnection : public QObject
44 {
45  Q_OBJECT
46 
47 public:
48  // constructor
50 
51  // destructor, disconnect if necessary
52  ~vtkQtConnection() override;
53 
54  // print function
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
57  // callback from VTK to emit signal
58  void Execute(vtkObject* caller, unsigned long event, void* client_data);
59 
60  // set the connection
61  void SetConnection(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
62  const char* slot, void* client_data, float priority = 0.0,
63  Qt::ConnectionType type = Qt::AutoConnection);
64 
65  // check if a connection matches input parameters
66  bool IsConnection(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
67  const char* slot, void* client_data);
68 
69  static void DoCallback(
70  vtkObject* vtk_obj, unsigned long event, void* client_data, void* call_data);
71 
72 signals:
73  // the qt signal for moc to take care of
74  void EmitExecute(vtkObject*, unsigned long, void* client_data, void* call_data, vtkCommand*);
75 
76 protected slots:
77  void deleteConnection();
78 
79 protected:
80  // the connection information
83  const QObject* QtObject;
84  void* ClientData;
85  unsigned long VTKEvent;
86  QString QtSlot;
88 
89 private:
91  void operator=(const vtkQtConnection&);
92 };
93 
94 #endif
95 // VTK-HeaderTest-Exclude: vtkQtConnection.h
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:377
vtkQtConnection::EmitExecute
void EmitExecute(vtkObject *, unsigned long, void *client_data, void *call_data, vtkCommand *)
vtkQtConnection::QtSlot
QString QtSlot
Definition: vtkQtConnection.h:86
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkEventQtSlotConnect
Manage connections between VTK events and Qt slots.
Definition: vtkEventQtSlotConnect.h:57
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkCommand.h
vtkQtConnection::QtObject
const QObject * QtObject
Definition: vtkQtConnection.h:83
vtkQtConnection::~vtkQtConnection
~vtkQtConnection() override
vtkQtConnection::Owner
vtkEventQtSlotConnect * Owner
Definition: vtkQtConnection.h:87
vtkQtConnection::deleteConnection
void deleteConnection()
vtkQtConnection::DoCallback
static void DoCallback(vtkObject *vtk_obj, unsigned long event, void *client_data, void *call_data)
vtkQtConnection::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkQtConnection
Definition: vtkQtConnection.h:43
vtkQtConnection::SetConnection
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)
vtkQtConnection::VTKEvent
unsigned long VTKEvent
Definition: vtkQtConnection.h:85
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:44
vtkQtConnection::ClientData
void * ClientData
Definition: vtkQtConnection.h:84
vtkQtConnection::vtkQtConnection
vtkQtConnection(vtkEventQtSlotConnect *owner)
vtkQtConnection::Execute
void Execute(vtkObject *caller, unsigned long event, void *client_data)
vtkQtConnection::Callback
vtkCallbackCommand * Callback
Definition: vtkQtConnection.h:82
vtkQtConnection::VTKObject
vtkObject * VTKObject
Definition: vtkQtConnection.h:81
vtkQtConnection::IsConnection
bool IsConnection(vtkObject *vtk_obj, unsigned long event, const QObject *qt_obj, const char *slot, void *client_data)
vtkX3D::priority
@ priority
Definition: vtkX3D.h:456