Browse Source

BUG: When searching through connections, the key NULL meaning any vtkObject

was not handled, this resulted in an empty search when doing something like
d->findConnections(0, event, qtObject, qtSlot); even if a connection was
matching the parameters (vtkObject != 0)
Julien Finet 15 years ago
parent
commit
b02d927136

+ 1 - 1
Libs/Visualization/VTK/Core/ctkVTKConnection.cpp

@@ -342,7 +342,7 @@ bool ctkVTKConnection::isEqual(vtkObject* vtk_obj, unsigned long vtk_event,
 {
   CTK_D(const ctkVTKConnection);
   
-  if (d->VTKObject != vtk_obj)
+  if (vtk_obj && d->VTKObject != vtk_obj)
     {
     return false;
     }

+ 12 - 0
Libs/Visualization/VTK/Core/ctkVTKConnection.h

@@ -33,6 +33,12 @@
 class vtkObject;
 class ctkVTKConnectionPrivate;
 
+/// Warning the slot must have its signature order:
+/// vtkObject*, vtkObject* : sender, callData
+/// or
+/// vtkObject*, void*, unsigned long, void*: sender, callData, eventId, clientData
+/// Of course the slot can contain less parameters, but always the same order
+/// though.
 class CTK_VISUALIZATION_VTK_CORE_EXPORT ctkVTKConnection : public QObject
 {
 Q_OBJECT
@@ -48,6 +54,12 @@ public:
     const QObject* qt_obj, QString qt_slot = "");
 
   /// 
+  /// Warning the slot must have its signature order:
+  /// vtkObject*, vtkObject* : sender, callData
+  /// or
+  /// vtkObject*, void*, unsigned long, void*: sender, callData, eventId, clientData
+  /// Of course the slot can contain less parameters, but always the same order
+  /// though.
   void setup(vtkObject* vtk_obj, unsigned long vtk_event,
     const QObject* qt_obj, QString qt_slot, float priority = 0.f);
 

+ 2 - 1
Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.cpp

@@ -280,7 +280,8 @@ ctkVTKObjectEventsObserverPrivate::findConnections(
   const QObject* qt_obj, const char* qt_slot)
 {
   bool all_info = true;
-  if(qt_slot == NULL || qt_obj == NULL || vtk_event == vtkCommand::NoEvent)
+  if(vtk_obj == NULL || qt_slot == NULL ||
+     qt_obj == NULL || vtk_event == vtkCommand::NoEvent)
     {
     all_info = false;
     }

+ 18 - 0
Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.h

@@ -51,18 +51,36 @@ public:
 
   /// 
   /// Add a connection, an Id allowing to uniquely identify the connection is also returned
+  /// Warning the slot must have its signature order:
+  /// vtkObject*, vtkObject* : sender, callData
+  /// or
+  /// vtkObject*, void*, unsigned long, void*: sender, callData, eventId, clientData
+  /// Of course the slot can contain less parameters, but always the same order
+  /// though.
   QString addConnection(vtkObject* vtk_obj, unsigned long vtk_event,
     const QObject* qt_obj, const char* qt_slot, float priority = 0.0);
 
   ///
   /// Utility function that remove a connection on old_vtk_obj and add a connection
   /// to vtk_obj (same event, object, slot, priority)
+  /// Warning the slot must have its signature order:
+  /// vtkObject*, vtkObject* : sender, callData
+  /// or
+  /// vtkObject*, void*, unsigned long, void*: sender, callData, eventId, clientData
+  /// Of course the slot can contain less parameters, but always the same order
+  /// though.
   QString addConnection(vtkObject* old_vtk_obj, vtkObject* vtk_obj, unsigned long vtk_event,
     const QObject* qt_obj, const char* qt_slot, float priority = 0.0);
 
   ///
   /// Utility function that remove a connection on old_vtk_obj and add a connection
   /// to vtk_obj (same event, object, slot, priority)
+  /// Warning the slot must have its signature order:
+  /// vtkObject*, vtkObject* : sender, callData
+  /// or
+  /// vtkObject*, void*, unsigned long, void*: sender, callData, eventId, clientData
+  /// Of course the slot can contain less parameters, but always the same order
+  /// though.
   QString reconnection(vtkObject* vtk_obj, unsigned long vtk_event,
                        const QObject* qt_obj, const char* qt_slot, 
                        float priority = 0.0);