From 6944d6c94632a43f40f7929dffcc216c24917c3d Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 19 Aug 2015 12:11:11 +0300 Subject: [PATCH] Issue #478 Problem of performance with selection --- .../ModuleBase_WidgetMultiSelector.cpp | 23 ++++++++++++------- .../ModuleBase_WidgetMultiSelector.h | 3 ++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 3425faca9..98f45e370 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -65,7 +65,8 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, const std::string& theParentId) - : ModuleBase_WidgetSelector(theParent, theWorkshop, theData, theParentId) + : ModuleBase_WidgetSelector(theParent, theWorkshop, theData, theParentId), + mySelectionType(""), mySelectionCount(0) { QGridLayout* aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); @@ -176,12 +177,14 @@ void ModuleBase_WidgetMultiSelector::storeAttributeValue() return; mySelectionType = aSelectionListAttr->selectionType(); - mySelection.clear(); + mySelectionCount = aSelectionListAttr->size(); + + /*mySelection.clear(); int aSize = aSelectionListAttr->size(); for (int i = 0; i < aSelectionListAttr->size(); i++) { AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); mySelection.append(GeomSelection(aSelectAttr->context(), aSelectAttr->value())); - } + }*/ } //******************************************************************** @@ -208,7 +211,7 @@ void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject, //******************************************************************** void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/) { - clearAttribute(); + //clearAttribute(); // Store shape type DataPtr aData = myFeature->data(); @@ -217,10 +220,14 @@ void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/) aSelectionListAttr->setSelectionType(mySelectionType); // Store selection in the attribute - int aSize = mySelection.size(); - foreach (GeomSelection aSelec, mySelection) { - setObject(aSelec.first, aSelec.second); - } + //int aSize = mySelection.size(); + //foreach (GeomSelection aSelec, mySelection) { + // setObject(aSelec.first, aSelec.second); + //} + + //int aCountAppened = aSelectionListAttr->size() - mySelectionCount; + //for ( int i = 0; i < aCountAppened; i++) + // aSelectionListAttr->removeLast(); } //******************************************************************** diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 693572f4e..d44edff7d 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -162,7 +162,8 @@ protected: std::string mySelectionType; /// Variable of GeomSelection - QList mySelection; + //QList mySelection; + int mySelectionCount; // number of elements in the attribute selection list when store bool myIsUseChoice; }; -- 2.39.2