From bd8aa65a3ce2db055ec64ca3bc363aa5d57f9953 Mon Sep 17 00:00:00 2001 From: =?utf8?q?CHEMIN=20S=C3=A9bastien=20236498?= Date: Mon, 3 Jun 2024 10:48:39 +0200 Subject: [PATCH] Clear selection before setting new one --- src/LightApp/LightApp_QTVSelector.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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); + } + } } } -- 2.39.2