From 8513abc01bef2fd9d98ba7e663e529ef66813bbb Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 26 Dec 2014 17:18:07 +0300 Subject: [PATCH] Provide names of sub-objects from Naming for Groups --- .../ModuleBase_WidgetMultiSelector.cpp | 47 ++++++++++--------- .../ModuleBase_WidgetMultiSelector.h | 3 +- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 5c50ce38e..211380338 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -15,7 +15,6 @@ #include #include -#include #include @@ -93,6 +92,7 @@ bool ModuleBase_WidgetMultiSelector::storeValue() const foreach (GeomSelection aSelec, mySelection) { aSelectionListAttr->append(aSelec.first, aSelec.second); } + //updateSelectionList(aSelectionListAttr); updateObject(myFeature); return true; } @@ -119,7 +119,7 @@ bool ModuleBase_WidgetMultiSelector::restoreValue() AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); mySelection.append(GeomSelection(aSelectAttr->context(), aSelectAttr->value())); } - updateSelectionList(); + updateSelectionList(aSelectionListAttr); return true; } return false; @@ -204,7 +204,7 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged() aShape->setImpl(new TopoDS_Shape(aShpIt.Value())); mySelection.append(GeomSelection(aResult, aShape)); } - updateSelectionList(); + //updateSelectionList(); emit valuesChanged(); } @@ -253,25 +253,30 @@ void ModuleBase_WidgetMultiSelector::activateShapeSelection() } //******************************************************************** -void ModuleBase_WidgetMultiSelector::updateSelectionList() +void ModuleBase_WidgetMultiSelector::updateSelectionList(AttributeSelectionListPtr theList) { - QString aType; - if (myTypeCombo->currentText().toLower() == "vertices") - aType = "vertex"; - else if (myTypeCombo->currentText().toLower() == "edges") - aType = "edge"; - else if (myTypeCombo->currentText().toLower() == "faces") - aType = "face"; - else if (myTypeCombo->currentText().toLower() == "solids") - aType = "solid"; - myListControl->clear(); - int i = 1; - foreach (GeomSelection aSel, mySelection) { - QString aName(aSel.first->data()->name().c_str()); - aName += ":" + aType + QString("_%1").arg(i); - myListControl->addItem(aName); - i++; + for (int i = 0; i < theList->size(); i++) { + AttributeSelectionPtr aAttr = theList->value(i); + myListControl->addItem(aAttr->namingName().c_str()); } - myListControl->repaint(); + //QString aType; + //if (myTypeCombo->currentText().toLower() == "vertices") + // aType = "vertex"; + //else if (myTypeCombo->currentText().toLower() == "edges") + // aType = "edge"; + //else if (myTypeCombo->currentText().toLower() == "faces") + // aType = "face"; + //else if (myTypeCombo->currentText().toLower() == "solids") + // aType = "solid"; + + //myListControl->clear(); + //int i = 1; + //foreach (GeomSelection aSel, mySelection) { + // QString aName(aSel.first->data()->name().c_str()); + // aName += ":" + aType + QString("_%1").arg(i); + // myListControl->addItem(aName); + // i++; + //} + //myListControl->repaint(); } diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index c38f72d07..47f08a5e6 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -67,7 +68,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model void activateShapeSelection(); private: - void updateSelectionList(); + void updateSelectionList(AttributeSelectionListPtr); QListWidget* myListControl; QComboBox* myTypeCombo; -- 2.39.2