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