From: mpv Date: Wed, 27 Dec 2006 07:50:33 +0000 (+0000) Subject: MPV NPAL13114: for OCCViewer we have to store not-displayed selected objects also... X-Git-Tag: V3_2_5pre1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9a76f33d312f544a85a788c7b97d37e8273acf4e;p=modules%2Fgui.git MPV NPAL13114: for OCCViewer we have to store not-displayed selected objects also. They are stored in mySelectedExternals field. It is filled in setSelected by not-displayed objects and it is appended to getSelected result list. onDeselection slot clears this list: in calls in case on selection in OCC viewer without shift pressed before setSelection method call. --- diff --git a/src/LightApp/LightApp_OCCSelector.cxx b/src/LightApp/LightApp_OCCSelector.cxx index 446ae593b..beb379e07 100644 --- a/src/LightApp/LightApp_OCCSelector.cxx +++ b/src/LightApp/LightApp_OCCSelector.cxx @@ -33,8 +33,10 @@ LightApp_OCCSelector::LightApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_Selec : SUIT_Selector( mgr, viewer ), myViewer( viewer ) { - if ( myViewer ) + if ( myViewer ) { connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); + connect( myViewer, SIGNAL( deselection() ), this, SLOT( onDeselection() ) ); + } } /*! @@ -58,6 +60,12 @@ void LightApp_OCCSelector::onSelectionChanged() selectionChanged(); } +/*!On selection cleared.*/ +void LightApp_OCCSelector::onDeselection() +{ + mySelectedExternals.clear(); +} + /*!Gets selection list.*/ void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const { @@ -77,6 +85,11 @@ void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) ); #endif } + // add externally selected objects + SUIT_DataOwnerPtrList::const_iterator anExtIter; + for(anExtIter = mySelectedExternals.begin(); anExtIter != mySelectedExternals.end(); anExtIter++) { + aList.append(*anExtIter); + } } /*!Sets selection list.*/ @@ -99,12 +112,16 @@ void LightApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) if ( !entryStr.isEmpty() ) aDisplayed.insert( entryStr, it.Value() ); } + + mySelectedExternals.clear(); for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) { const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); if ( owner && aDisplayed.contains( owner->entry() ) ) aSelList.Append( aDisplayed[owner->entry()] ); + else + mySelectedExternals.append(*itr); } myViewer->unHighlightAll( false ); diff --git a/src/LightApp/LightApp_OCCSelector.h b/src/LightApp/LightApp_OCCSelector.h index c358efe8a..f0da3b251 100644 --- a/src/LightApp/LightApp_OCCSelector.h +++ b/src/LightApp/LightApp_OCCSelector.h @@ -22,6 +22,7 @@ #include "LightApp.h" #include +#include #include @@ -45,6 +46,7 @@ public: private slots: virtual void onSelectionChanged(); + virtual void onDeselection(); protected: virtual void getSelection( SUIT_DataOwnerPtrList& ) const; @@ -52,6 +54,8 @@ protected: QString entry( const Handle_AIS_InteractiveObject& ) const; + SUIT_DataOwnerPtrList mySelectedExternals; + private: OCCViewer_Viewer* myViewer; };