VTK  9.3.1
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 
39 #ifndef vtkEventQtSlotConnect_h
40 #define vtkEventQtSlotConnect_h
41 
42 #include "QVTKWin32Header.h" // for export define
43 #include "vtkCommand.h" // for event defines
44 #include "vtkGUISupportQtModule.h" // For export macro
45 #include "vtkObject.h"
46 #include <QtCore/QObject> // for version info
47 
48 class QObject;
49 
50 VTK_ABI_NAMESPACE_BEGIN
51 class vtkQtConnections;
52 class vtkQtConnection;
53 
54 // manage connections between VTK object events and Qt slots
55 class VTKGUISUPPORTQT_EXPORT vtkEventQtSlotConnect : public vtkObject
56 {
57 public:
58  static vtkEventQtSlotConnect* New();
60 
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
70  virtual void Connect(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
71  const char* slot, void* client_data = nullptr, float priority = 0.0,
72  Qt::ConnectionType type = Qt::AutoConnection);
73 
82  virtual void Disconnect(vtkObject* vtk_obj = nullptr, unsigned long event = vtkCommand::NoEvent,
83  const QObject* qt_obj = nullptr, const char* slot = nullptr, void* client_data = nullptr);
84 
89  virtual int GetNumberOfConnections() const;
90 
91 protected:
92  vtkQtConnections* Connections;
93  friend class vtkQtConnection;
94  void RemoveConnection(vtkQtConnection*);
95 
97  ~vtkEventQtSlotConnect() override;
98 
99 private:
101  void operator=(const vtkEventQtSlotConnect&) = delete;
102 };
103 
104 VTK_ABI_NAMESPACE_END
105 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
vtkQtConnections * Connections
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Manage connections between VTK events and Qt slots.
a simple class to control print indentation
Definition: vtkIndent.h:28
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...