VTK  9.3.20240420
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
58#ifndef vtkEventQtSlotConnect_h
59#define vtkEventQtSlotConnect_h
60
61#include "QVTKWin32Header.h" // for export define
62#include "vtkCommand.h" // for event defines
63#include "vtkGUISupportQtModule.h" // For export macro
64#include "vtkObject.h"
65#include <QtCore/QObject> // for version info
66
67class QObject;
68
69VTK_ABI_NAMESPACE_BEGIN
70class vtkQtConnections;
71class vtkQtConnection;
72
73// manage connections between VTK object events and Qt slots
74class VTKGUISUPPORTQT_EXPORT vtkEventQtSlotConnect : public vtkObject
75{
76public:
79
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89 virtual void Connect(vtkObject* vtk_obj, unsigned long event, const QObject* qt_obj,
90 const char* slot, void* client_data = nullptr, float priority = 0.0,
91 Qt::ConnectionType type = Qt::AutoConnection);
92
101 virtual void Disconnect(vtkObject* vtk_obj = nullptr, unsigned long event = vtkCommand::NoEvent,
102 const QObject* qt_obj = nullptr, const char* slot = nullptr, void* client_data = nullptr);
103
108 virtual int GetNumberOfConnections() const;
109
110protected:
111 vtkQtConnections* Connections;
112 friend class vtkQtConnection;
114
117
118private:
120 void operator=(const vtkEventQtSlotConnect&) = delete;
121};
122
123VTK_ABI_NAMESPACE_END
124#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:108
abstract base class for most VTK objects
Definition vtkObject.h:162