From: vsr Date: Tue, 14 Jun 2005 09:55:13 +0000 (+0000) Subject: SUIT_Selector class now inherits QObject in order to simplify selectors deleting... X-Git-Tag: T3_0_0_a4~119 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c94a7aa2a3ddd94aca678ebed0a817a8b7fc6c92;p=modules%2Fgui.git SUIT_Selector class now inherits QObject in order to simplify selectors deleting process (selector is removed together with its parent) --- diff --git a/src/SUIT/Makefile.in b/src/SUIT/Makefile.in index d1a9ee271..a7ab82dac 100755 --- a/src/SUIT/Makefile.in +++ b/src/SUIT/Makefile.in @@ -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 \ diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index b8916f8ff..6384d2bd3 100755 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -8,6 +8,7 @@ myIsSelChangeEnabled( true ) SUIT_SelectionMgr::~SUIT_SelectionMgr() { + mySelectors.setAutoDelete( true ); } void SUIT_SelectionMgr::installSelector( SUIT_Selector* sel ) diff --git a/src/SUIT/SUIT_SelectionMgr.h b/src/SUIT/SUIT_SelectionMgr.h index bc1b66faa..ea61a6cf0 100755 --- a/src/SUIT/SUIT_SelectionMgr.h +++ b/src/SUIT/SUIT_SelectionMgr.h @@ -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& ) const; void selectors( const QString&, QPtrList& ) const; @@ -64,6 +61,9 @@ protected: typedef QPtrListIterator SelectorListIterator; + virtual void installSelector( SUIT_Selector* ); + virtual void removeSelector( SUIT_Selector* ); + private: void filterOwners( const SUIT_DataOwnerPtrList&, SUIT_DataOwnerPtrList& ) const; diff --git a/src/SUIT/SUIT_Selector.cxx b/src/SUIT/SUIT_Selector.cxx index d0b3da04f..de78e4945 100755 --- a/src/SUIT/SUIT_Selector.cxx +++ b/src/SUIT/SUIT_Selector.cxx @@ -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 ) diff --git a/src/SUIT/SUIT_Selector.h b/src/SUIT/SUIT_Selector.h index 5d74f0197..6ee8479fa 100755 --- a/src/SUIT/SUIT_Selector.h +++ b/src/SUIT/SUIT_Selector.h @@ -4,14 +4,16 @@ #include "SUIT.h" #include +#include 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; diff --git a/src/SUIT/SUIT_Study.cxx b/src/SUIT/SUIT_Study.cxx index cbff2154e..ea157b387 100755 --- a/src/SUIT/SUIT_Study.cxx +++ b/src/SUIT/SUIT_Study.cxx @@ -15,7 +15,7 @@ myName( "" ) { static int _id = 0; - myId = _id++; + myId = ++_id; myRoot = new SUIT_DataObject(); myOperations.setAutoDelete( false ); diff --git a/src/SalomeApp/SalomeApp_GLSelector.cxx b/src/SalomeApp/SalomeApp_GLSelector.cxx index a090a1dfd..4b1351e18 100644 --- a/src/SalomeApp/SalomeApp_GLSelector.cxx +++ b/src/SalomeApp/SalomeApp_GLSelector.cxx @@ -7,9 +7,8 @@ #include 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() ) ); diff --git a/src/SalomeApp/SalomeApp_GLSelector.h b/src/SalomeApp/SalomeApp_GLSelector.h index 1f7055028..cd61d3298 100644 --- a/src/SalomeApp/SalomeApp_GLSelector.h +++ b/src/SalomeApp/SalomeApp_GLSelector.h @@ -3,13 +3,11 @@ #include "SalomeApp.h" -#include - #include #include -class SALOMEAPP_EXPORT SalomeApp_GLSelector : public QObject, public SUIT_Selector +class SALOMEAPP_EXPORT SalomeApp_GLSelector : public SUIT_Selector { Q_OBJECT diff --git a/src/SalomeApp/SalomeApp_OBSelector.cxx b/src/SalomeApp/SalomeApp_OBSelector.cxx index 22dd4ed1f..e40eecfc8 100644 --- a/src/SalomeApp/SalomeApp_OBSelector.cxx +++ b/src/SalomeApp/SalomeApp_OBSelector.cxx @@ -8,9 +8,8 @@ #include 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() ) ); diff --git a/src/SalomeApp/SalomeApp_OBSelector.h b/src/SalomeApp/SalomeApp_OBSelector.h index d4ffbd2e3..9a3d5a848 100644 --- a/src/SalomeApp/SalomeApp_OBSelector.h +++ b/src/SalomeApp/SalomeApp_OBSelector.h @@ -5,12 +5,10 @@ #include -#include - 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 diff --git a/src/SalomeApp/SalomeApp_OCCSelector.cxx b/src/SalomeApp/SalomeApp_OCCSelector.cxx index b9d4d5af3..b394d5b3d 100644 --- a/src/SalomeApp/SalomeApp_OCCSelector.cxx +++ b/src/SalomeApp/SalomeApp_OCCSelector.cxx @@ -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() ) ); diff --git a/src/SalomeApp/SalomeApp_OCCSelector.h b/src/SalomeApp/SalomeApp_OCCSelector.h index e315f5f99..05ace6387 100644 --- a/src/SalomeApp/SalomeApp_OCCSelector.h +++ b/src/SalomeApp/SalomeApp_OCCSelector.h @@ -7,11 +7,9 @@ #include -#include - class Handle_AIS_InteractiveObject; -class SALOMEAPP_EXPORT SalomeApp_OCCSelector : public QObject, public SUIT_Selector +class SALOMEAPP_EXPORT SalomeApp_OCCSelector : public SUIT_Selector { Q_OBJECT diff --git a/src/SalomeApp/SalomeApp_VTKSelector.cxx b/src/SalomeApp/SalomeApp_VTKSelector.cxx index e67be28b4..f70d906c2 100644 --- a/src/SalomeApp/SalomeApp_VTKSelector.cxx +++ b/src/SalomeApp/SalomeApp_VTKSelector.cxx @@ -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 ) diff --git a/src/SalomeApp/SalomeApp_VTKSelector.h b/src/SalomeApp/SalomeApp_VTKSelector.h index 389adcf47..00420acc0 100644 --- a/src/SalomeApp/SalomeApp_VTKSelector.h +++ b/src/SalomeApp/SalomeApp_VTKSelector.h @@ -1,8 +1,6 @@ #ifndef SALOMEAPP_VTKSELECTOR_H #define SALOMEAPP_VTKSELECTOR_H -#include - #include #include @@ -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;