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
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
48class QObject;
49
50VTK_ABI_NAMESPACE_BEGIN
51class vtkQtConnections;
52class vtkQtConnection;
53
54// manage connections between VTK object events and Qt slots
55class VTKGUISUPPORTQT_EXPORT vtkEventQtSlotConnect : public vtkObject
56{
57public:
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
91protected:
92 vtkQtConnections* Connections;
93 friend class vtkQtConnection;
95
98
99private:
101 void operator=(const vtkEventQtSlotConnect&) = delete;
102};
103
104VTK_ABI_NAMESPACE_END
105#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:29
abstract base class for most VTK objects
Definition vtkObject.h:49