VTK
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 
31 #ifndef vtkQtConnection_h
32 #define vtkQtConnection_h
33 
34 #include "vtkCommand.h" // for event defines
35 #include <QObject>
36 
37 class vtkObject;
38 class vtkCallbackCommand;
40 
41 // class for managing a single VTK/Qt connection
42 // not to be included in other projects
43 // only here for moc to process for vtkEventQtSlotConnect
44 class vtkQtConnection : public QObject
45 {
46  Q_OBJECT
47 
48  public:
49 
50  // constructor
52 
53  // destructor, disconnect if necessary
54  ~vtkQtConnection() override;
55 
56  // print function
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
59  // callback from VTK to emit signal
60  void Execute(vtkObject* caller, unsigned long event, void* client_data);
61 
62  // set the connection
63  void SetConnection(vtkObject* vtk_obj, unsigned long event,
64  const QObject* qt_obj, const char* slot,
65  void* client_data, float priority=0.0
66  ,Qt::ConnectionType type = Qt::AutoConnection);
67 
68  // check if a connection matches input parameters
69  bool IsConnection(vtkObject* vtk_obj, unsigned long event,
70  const QObject* qt_obj, const char* slot,
71  void* client_data);
72 
73  static void DoCallback(vtkObject* vtk_obj, unsigned long event,
74  void* client_data, void* call_data);
75 
76  signals:
77  // the qt signal for moc to take care of
78  void EmitExecute(vtkObject*, unsigned long, void* client_data, void* call_data, vtkCommand*);
79 
80  protected slots:
81  void deleteConnection();
82 
83  protected:
84 
85  // the connection information
88  const QObject* QtObject;
89  void* ClientData;
90  unsigned long VTKEvent;
91  QString QtSlot;
93 
94  private:
96  void operator=(const vtkQtConnection&);
97 
98 };
99 
100 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
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:370
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:39
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