VTK  9.1.0
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
36class vtkObject;
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
43class vtkQtConnection : public QObject
44{
45 Q_OBJECT
46
47public:
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
72Q_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
76protected Q_SLOTS:
78
79protected:
80 // the connection information
83 const QObject* QtObject;
85 unsigned long VTKEvent;
86 QString QtSlot;
88
89private:
91 void operator=(const vtkQtConnection&);
92};
93
94#endif
95// VTK-HeaderTest-Exclude: vtkQtConnection.h
supports function callbacks
superclass for callback/observer methods
Definition: vtkCommand.h:394
Manage connections between VTK events and Qt slots.
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
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)
@ priority
Definition: vtkX3D.h:456
@ type
Definition: vtkX3D.h:522