From: CHEMIN Sébastien 236498 Date: Mon, 3 Jun 2024 08:46:43 +0000 (+0200) Subject: Clear selection before setting new one X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bafc9c6e04d2d27e1d25c91de737be9187285388;p=modules%2Fgui.git Clear selection before setting new one --- diff --git a/src/LightApp/LightApp_QTVSelector.cxx b/src/LightApp/LightApp_QTVSelector.cxx index 4c6554a30..f6f54e47b 100644 --- a/src/LightApp/LightApp_QTVSelector.cxx +++ b/src/LightApp/LightApp_QTVSelector.cxx @@ -78,15 +78,16 @@ void LightApp_QTVSelector::setSelection( const SUIT_DataOwnerPtrList& theList) if( QtViewer_ViewPort* aViewport = myViewer->getActiveViewPort() ) { - foreach (QGraphicsItem *item, aViewport->items()) - { - if (QtViewer_Object* obj = dynamic_cast(item)) - { - LightApp_DataOwner* owner = dynamic_cast( obj->owner() ); - bool sel = owner && aSelected.contains(owner->entry()); - obj->setSelected(sel); - } - } + aViewport->scene()->clearSelection(); + foreach (QGraphicsItem *item, aViewport->items()) + { + if (QtViewer_Object* obj = dynamic_cast(item)) + { + LightApp_DataOwner* owner = dynamic_cast( obj->owner() ); + bool sel = owner && aSelected.contains(owner->entry()); + obj->setSelected(sel); + } + } } }