]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
SUIT_Selector class now inherits QObject in order to simplify selectors deleting...
authorvsr <vsr@opencascade.com>
Tue, 14 Jun 2005 09:55:13 +0000 (09:55 +0000)
committervsr <vsr@opencascade.com>
Tue, 14 Jun 2005 09:55:13 +0000 (09:55 +0000)
14 files changed:
src/SUIT/Makefile.in
src/SUIT/SUIT_SelectionMgr.cxx
src/SUIT/SUIT_SelectionMgr.h
src/SUIT/SUIT_Selector.cxx
src/SUIT/SUIT_Selector.h
src/SUIT/SUIT_Study.cxx
src/SalomeApp/SalomeApp_GLSelector.cxx
src/SalomeApp/SalomeApp_GLSelector.h
src/SalomeApp/SalomeApp_OBSelector.cxx
src/SalomeApp/SalomeApp_OBSelector.h
src/SalomeApp/SalomeApp_OCCSelector.cxx
src/SalomeApp/SalomeApp_OCCSelector.h
src/SalomeApp/SalomeApp_VTKSelector.cxx
src/SalomeApp/SalomeApp_VTKSelector.h

index d1a9ee27130819428cd135402ae88f2d6375daef..a7ab82dacf6826f7907c97dbf44ed5b9ab1c5a1d 100755 (executable)
@@ -89,7 +89,8 @@ LIB_MOC = SUIT_ActionOperation.h \
          SUIT_ViewModel.h \
          SUIT_ViewWindow.h \
          SUIT_ViewManager.h \
-         SUIT_SelectionMgr.h
+         SUIT_SelectionMgr.h \
+          SUIT_Selector.h
 
 RESOURCES_FILES = \
        cascade.png \
index b8916f8ff0d58c91ee04fb66154e404071a485a8..6384d2bd3e83dcdca77777d67b854d7282afca63 100755 (executable)
@@ -8,6 +8,7 @@ myIsSelChangeEnabled( true )
 
 SUIT_SelectionMgr::~SUIT_SelectionMgr()
 {
+  mySelectors.setAutoDelete( true );
 }
 
 void SUIT_SelectionMgr::installSelector( SUIT_Selector* sel )
index bc1b66faac1ad375e1ad3b46dd096d0a0dcff95d..ea61a6cf041a6695c6593a7b085bd7a9379b80b4 100755 (executable)
@@ -21,9 +21,6 @@ public:
   virtual void    selected( SUIT_DataOwnerPtrList&, const QString& = QString::null ) const;
   virtual void    setSelected( const SUIT_DataOwnerPtrList&, const bool = false );
 
-  virtual void    installSelector( SUIT_Selector* );
-  virtual void    removeSelector( SUIT_Selector* );
-
   void            selectors( QPtrList<SUIT_Selector>& ) const;
   void            selectors( const QString&, QPtrList<SUIT_Selector>& ) const;
 
@@ -64,6 +61,9 @@ protected:
 
   typedef QPtrListIterator<SUIT_Selector>        SelectorListIterator;
 
+  virtual void    installSelector( SUIT_Selector* );
+  virtual void    removeSelector( SUIT_Selector* );
+
 private:
   void            filterOwners( const SUIT_DataOwnerPtrList&, SUIT_DataOwnerPtrList& ) const;
 
index d0b3da04fc9e9b2ece22f866270725ec11c09567..de78e49456f244bff37dd857c9b3bc3668843395 100755 (executable)
@@ -2,8 +2,9 @@
 
 #include "SUIT_SelectionMgr.h"
 
-SUIT_Selector::SUIT_Selector( SUIT_SelectionMgr* selMgr )
-: mySelMgr( selMgr ),
+SUIT_Selector::SUIT_Selector( SUIT_SelectionMgr* selMgr, QObject* parent ) :
+QObject( parent ), 
+mySelMgr( selMgr ),
 myBlock( false ),
 myEnabled( true ),
 myAutoBlock( true )
index 5d74f019702f5867baa2c65b56df697d042e2919..6ee8479fa7e47c4ba458a51e9187070a871d72a7 100755 (executable)
@@ -4,14 +4,16 @@
 #include "SUIT.h"
 
 #include <qvaluelist.h>
+#include <qobject.h>
 
 class SUIT_SelectionMgr;
 class SUIT_DataOwnerPtrList;
 
-class SUIT_EXPORT SUIT_Selector
+class SUIT_EXPORT SUIT_Selector : public QObject
 {
+  Q_OBJECT
 public:
-  SUIT_Selector( SUIT_SelectionMgr* );
+  SUIT_Selector( SUIT_SelectionMgr*, QObject* = 0 );
   virtual ~SUIT_Selector();
 
   virtual QString    type() const = 0;
index cbff2154e0997ea1312318b9a452adb13ea02128..ea157b387a18515888e23409d0343e6f7c964232 100755 (executable)
@@ -15,7 +15,7 @@ myName( "" )
 {
   static int _id = 0;
 
-  myId = _id++;
+  myId = ++_id;
 
   myRoot = new SUIT_DataObject();
   myOperations.setAutoDelete( false );
index a090a1dfde9e6ac3720d144a7fd5a6883be23388..4b1351e18bdfd85f0403aa1830a3795ed37f4eb8 100644 (file)
@@ -7,9 +7,8 @@
 #include <GLViewer_Context.h>
 
 SalomeApp_GLSelector::SalomeApp_GLSelector( GLViewer_Viewer2d* viewer, SUIT_SelectionMgr* mgr )
-: QObject( 0 ),
-SUIT_Selector( mgr ),
-myViewer( viewer )
+: SUIT_Selector( mgr, viewer ),
+  myViewer( viewer )
 {
   if ( myViewer )
     connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
index 1f7055028e030ceb99e6036a18fbf4a369664f4c..cd61d3298dbdd190181e02d1679bb616b4d8abb8 100644 (file)
@@ -3,13 +3,11 @@
 
 #include "SalomeApp.h"
 
-#include <qobject.h>
-
 #include <SUIT_Selector.h>
 
 #include <GLViewer_Viewer2d.h>
 
-class SALOMEAPP_EXPORT SalomeApp_GLSelector : public QObject, public SUIT_Selector
+class SALOMEAPP_EXPORT SalomeApp_GLSelector : public SUIT_Selector
 {
   Q_OBJECT
 
index 22dd4ed1f5cf5e1d650d7b8ced9cd9b1e80707d0..e40eecfc8b67be2cc36e0c14a58a2a95d05cfda1 100644 (file)
@@ -8,9 +8,8 @@
 #include <SUIT_DataObjectIterator.h>
 
 SalomeApp_OBSelector::SalomeApp_OBSelector( OB_Browser* ob, SUIT_SelectionMgr* mgr )
-: QObject( 0 ),
-SUIT_Selector( mgr ),
-myBrowser( ob )
+: SUIT_Selector( mgr, ob ),
+  myBrowser( ob )
 {
   if ( myBrowser ) {
     connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
index d4ffbd2e3e30db3bd4e4c7718a232d8e786720aa..9a3d5a8480d3a7596acd259dd91dad15efd2e1a3 100644 (file)
@@ -5,12 +5,10 @@
 
 #include <SUIT_Selector.h>
 
-#include <qobject.h>
-
 class OB_Browser;
 class SalomeApp_DataObject;
 
-class SALOMEAPP_EXPORT SalomeApp_OBSelector : public QObject, public SUIT_Selector
+class SALOMEAPP_EXPORT SalomeApp_OBSelector : public SUIT_Selector
 {
   Q_OBJECT
 
index b9d4d5af30f5c1aacbc55b32e19bf6ed6d7a43f5..b394d5b3de35513e6ca07dae9fac8f27a9cc03e4 100644 (file)
@@ -9,9 +9,8 @@
 
 
 SalomeApp_OCCSelector::SalomeApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr )
-: QObject( 0 ),
-SUIT_Selector( mgr ),
-myViewer( viewer )
+: SUIT_Selector( mgr, viewer ),
+  myViewer( viewer )
 {
   if ( myViewer )
     connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
index e315f5f991e1bc3865150303ce1135158ccf3eb5..05ace63871735b3f4e8ce89dd725b4dde3fd7983 100644 (file)
@@ -7,11 +7,9 @@
 
 #include <OCCViewer_ViewModel.h>
 
-#include <qobject.h>
-
 class Handle_AIS_InteractiveObject;
 
-class SALOMEAPP_EXPORT SalomeApp_OCCSelector : public QObject, public SUIT_Selector
+class SALOMEAPP_EXPORT SalomeApp_OCCSelector : public SUIT_Selector
 {
   Q_OBJECT
 
index e67be28b4f178fe339fc1abf2cc7f5f69a1d8562..f70d906c262f56e271ed99a2c5ffb98afbf30754 100644 (file)
@@ -44,8 +44,7 @@ SalomeApp_SVTKDataOwner
 SalomeApp_VTKSelector
 ::SalomeApp_VTKSelector( SVTK_Viewer* viewer, 
                         SUIT_SelectionMgr* mgr ): 
-  QObject( 0 ),
-  SUIT_Selector( mgr ),
+  SUIT_Selector( mgr, viewer ),
   myViewer( viewer )
 {
   if ( myViewer )
index 389adcf47669d133286eac7d48daa5d93c8f6e70..00420acc0d79574981ec4fa89d600aa7931a16c9 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef SALOMEAPP_VTKSELECTOR_H
 #define SALOMEAPP_VTKSELECTOR_H
 
-#include <qobject.h>
-
 #include <vtkSmartPointer.h>
 
 #include <TColStd_IndexedMapOfInteger.hxx>
@@ -46,7 +44,7 @@ class SalomeApp_SVTKDataOwner : public SalomeApp_DataOwner
 };
 
 
-class SALOMEAPP_EXPORT SalomeApp_VTKSelector : public QObject, public SUIT_Selector
+class SALOMEAPP_EXPORT SalomeApp_VTKSelector : public SUIT_Selector
 {
   Q_OBJECT;