VTK  9.3.0
vtkEventQtSlotConnect.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2004 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4 
5 /*========================================================================
6  For general information about using VTK and Qt, see:
7  http://www.trolltech.com/products/3rdparty/vtksupport.html
8 =========================================================================*/
9 
10 /*========================================================================
11  !!! WARNING for those who want to contribute code to this file.
12  !!! If you use a commercial edition of Qt, you can modify this code.
13  !!! If you use an open source version of Qt, you are free to modify
14  !!! and use this code within the guidelines of the GPL license.
15  !!! Unfortunately, you cannot contribute the changes back into this
16  !!! file. Doing so creates a conflict between the GPL and BSD-like VTK
17  !!! license.
18 =========================================================================*/
19 
48 #ifndef vtkEventQtSlotConnect_h
49 #define vtkEventQtSlotConnect_h
50 
51 #include "QVTKWin32Header.h" // for export define
52 #include "vtkCommand.h" // for event defines
53 #include "vtkGUISupportQtModule.h" // For export macro
54 #include "vtkObject.h"
55 #include <QtCore/QObject> // for version info
56 
57 class QObject;
58 
59 VTK_ABI_NAMESPACE_BEGIN
60 class vtkQtConnections;
61 class vtkQtConnection;
62 
63 // manage connections between VTK object events and Qt slots
64 class VTKGUISUPPORTQT_EXPORT vtkEventQtSlotConnect : public vtkObject
65 {
66 public:
69 
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
79  virtual void Connect(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
80  const char* slot, void* client_data = nullptr, float priority = 0.0,
81  Qt::ConnectionType type = Qt::AutoConnection);
82 
91  virtual void Disconnect(vtkObject* vtk_obj = nullptr, unsigned long event = vtkCommand::NoEvent,
92  const QObject* qt_obj = nullptr, const char* slot = nullptr, void* client_data = nullptr);
93 
98  virtual int GetNumberOfConnections() const;
99 
100 protected:
101  vtkQtConnections* Connections;
102  friend class vtkQtConnection;
104 
107 
108 private:
110  void operator=(const vtkEventQtSlotConnect&) = delete;
111 };
112 
113 VTK_ABI_NAMESPACE_END
114 #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:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
@ priority
Definition: vtkX3D.h:450
@ type
Definition: vtkX3D.h:516