From a62ca8b3467dca12005f88a209fafed705a3d368 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 10 Apr 2015 15:02:01 +0300 Subject: [PATCH] Improve multi-selection control --- src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp | 5 +++-- src/XGUI/XGUI_Displayer.cpp | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 9d74cc2fb..53f035275 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -282,11 +282,10 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged() } } } + emit valuesChanged(); // the updateObject method should be called to flush the updated sigal. The workshop listens it, // calls validators for the feature and, as a result, updates the Apply button state. updateObject(myFeature); - - emit valuesChanged(); } //******************************************************************** @@ -334,6 +333,8 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList(AttributeSelectionListP AttributeSelectionPtr aAttr = theList->value(i); myListControl->addItem(aAttr->namingName().c_str()); } + // We have to call repaint because sometimes the List control is not updated + myListControl->repaint(); } //******************************************************************** diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index d920f4630..0eff27bb2 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -46,7 +46,7 @@ const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse //#define DEBUG_DISPLAY //#define DEBUG_ACTIVATE //#define DEBUG_FEATURE_REDISPLAY -#define DEBUG_SELECTION_FILTERS +//#define DEBUG_SELECTION_FILTERS // Workaround for bug #25637 void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList) @@ -707,7 +707,13 @@ void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilte if (theFilter.Access() == aIt.Value().Access()) return; } - GetFilter()->Add(theFilter); + Handle(SelectMgr_CompositionFilter) aCompFilter = GetFilter(); + const SelectMgr_ListOfFilter& aStoredFilters = aCompFilter->StoredFilters(); + for (aIt.Initialize(aStoredFilters); aIt.More(); aIt.Next()) { + if (theFilter.Access() == aIt.Value().Access()) + return; + } + aCompFilter->Add(theFilter); #ifdef DEBUG_SELECTION_FILTERS int aCount = GetFilter()->StoredFilters().Extent(); qDebug(QString("addSelectionFilter: filters.count() = %1").arg(aCount).toStdString().c_str()); -- 2.39.2