VTK  9.2.5
vtkEventQtSlotConnect.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 
65 #ifndef vtkEventQtSlotConnect_h
66 #define vtkEventQtSlotConnect_h
67 
68 #include "QVTKWin32Header.h" // for export define
69 #include "vtkCommand.h" // for event defines
70 #include "vtkGUISupportQtModule.h" // For export macro
71 #include "vtkObject.h"
72 #include <QtCore/QObject> // for version info
73 
74 class QObject;
75 class vtkQtConnections;
76 class vtkQtConnection;
77 
78 // manage connections between VTK object events and Qt slots
79 class VTKGUISUPPORTQT_EXPORT vtkEventQtSlotConnect : public vtkObject
80 {
81 public:
84 
88  void PrintSelf(ostream& os, vtkIndent indent) override;
89 
94  virtual void Connect(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
95  const char* slot, void* client_data = nullptr, float priority = 0.0,
96  Qt::ConnectionType type = Qt::AutoConnection);
97 
106  virtual void Disconnect(vtkObject* vtk_obj = nullptr, unsigned long event = vtkCommand::NoEvent,
107  const QObject* qt_obj = nullptr, const char* slot = nullptr, void* client_data = nullptr);
108 
113  virtual int GetNumberOfConnections() const;
114 
115 protected:
116  vtkQtConnections* Connections;
117  friend class vtkQtConnection;
119 
122 
123 private:
125  void operator=(const vtkEventQtSlotConnect&) = delete;
126 };
127 
128 #endif
Manage connections between VTK events and Qt slots.
vtkQtConnections * Connections
virtual int GetNumberOfConnections() const
Allow to query vtkEventQtSlotConnect to know if some Connect() have been setup and how many.
virtual void Disconnect(vtkObject *vtk_obj=nullptr, unsigned long event=vtkCommand::NoEvent, const QObject *qt_obj=nullptr, const char *slot=nullptr, void *client_data=nullptr)
Disconnect a vtk object from a qt object.
static vtkEventQtSlotConnect * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Print the current connections between VTK and Qt.
~vtkEventQtSlotConnect() override
virtual void Connect(vtkObject *vtk_obj, unsigned long event, const QObject *qt_obj, const char *slot, void *client_data=nullptr, float priority=0.0, Qt::ConnectionType type=Qt::AutoConnection)
Connect a vtk object's event with a Qt object's slot.
void RemoveConnection(vtkQtConnection *)
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
@ priority
Definition: vtkX3D.h:456
@ type
Definition: vtkX3D.h:522