X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUIT%2FSUIT_SelectionMgr.cxx;h=03ccbb08a324203759937d59dbbda281ce73073e;hb=855f4002aa71d468682a50c484a19579a51bf78c;hp=48d5331b11ac9fcd843fb0cf5759734c868e122c;hpb=627194285d9b5354291d3a442b68b8740f114eda;p=modules%2Fgui.git diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index 48d5331b1..03ccbb08a 100755 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -92,7 +92,7 @@ void SUIT_SelectionMgr::setEnabled( const bool on, const QString& typ ) /*! Gets selected data owners from list with type \a type to list \a lst. */ -void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& type ) const +void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& type, const bool onlyOne ) const { lst.clear(); @@ -103,10 +103,25 @@ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& typ if ( !type.isEmpty() && (*it)->type() != type ) continue; - SUIT_DataOwnerPtrList curList; + SUIT_DataOwnerPtrList curList( /*skipAllEqual=*/false ); (*it)->selected( curList ); - for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr ) - lst.append( *itr ); + if ( onlyOne ) + { + for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr ) + { + lst.append( *itr ); + if ( lst.count() > 1 ) + { + lst.clear(); + return; + } + } + } + else + { + for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr ) + lst.append( *itr ); + } } }