From b4dc47afe796ac81456fbe94f1a541f674a79682 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 23 Sep 2020 18:37:37 +0300 Subject: [PATCH] bos #20090: Can't select external wire of a sketch --- src/FeaturesPlugin/extrusion_widget.xml | 4 ++-- src/FeaturesPlugin/extrusionfuse_widget.xml | 4 ++-- .../ModuleBase_WidgetMultiSelector.cpp | 17 +++++++++++------ src/ModuleBase/ModuleBase_WidgetMultiSelector.h | 2 +- src/PartSet/PartSet_WidgetSketchCreator.cpp | 10 ++++++++-- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index 94a9d4bc3..df1631146 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -5,7 +5,7 @@ 1. Planar face of non-sketch object or a plane. Sketch creation will be started.<br /> 2. An existing sketch face or contour. Extrusion will be filled by it.<br /> 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it." - shape_types="Vertices Edges Faces" + shape_types="Vertices Edges Faces|Wires" type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png" default_type = "2" use_choice="true"> @@ -14,7 +14,7 @@ @@ -16,7 +16,7 @@ label="Select a sketch face" icon="icons/Features/sketch.png" tooltip="Select a sketch face" - shape_types="Vertices Edges Faces" + shape_types="Vertices Edges Faces|Wire" type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png" default_type = "2" use_choice="true" diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 21df54023..bb5c6e39d 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -352,7 +352,7 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom() if (aSelectionType.empty()) aSelectionListAttr->setSelectionType(myDefMode); else { - setCurrentShapeType(ModuleBase_Tools::shapeType(aSelectionType.c_str())); + setCurrentShapeType(aSelectionType.c_str()); myDefMode = aSelectionType; myIsFirst = false; } @@ -752,23 +752,28 @@ QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const QIntList aShapeTypes; if (myShapeTypes.length() > 1 && myIsUseChoice) { - aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCtrl->textValue())); + QStringList aTypes = myTypeCtrl->textValue().split("|", QString::SkipEmptyParts); + for(QString aType: aTypes) { + aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); + } } else { foreach (QString aType, myShapeTypes) { - aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); + QStringList aSubTypes = aType.split("|", QString::SkipEmptyParts); + for(QString aSubType: aSubTypes) { + aShapeTypes.append(ModuleBase_Tools::shapeType(aSubType)); + } } } return aShapeTypes; } //******************************************************************** -void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const int theShapeType) +void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const QString& theShapeType) { int idx = 0; foreach (QString aShapeTypeName, myShapeTypes) { - int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName); - if(aRefType == theShapeType && idx != myTypeCtrl->value()) { + if(aShapeTypeName == theShapeType && idx != myTypeCtrl->value()) { updateSelectionModesAndFilters(false); bool isBlocked = myTypeCtrl->blockSignals(true); myTypeCtrl->setValue(idx); diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 8e788d655..946b46d77 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -182,7 +182,7 @@ protected: virtual QIntList shapeTypes() const; /// Set current shape type for selection - void setCurrentShapeType(const int theShapeType); + void setCurrentShapeType(const QString& theShapeType); /// Return the attribute values wrapped in a list of viewer presentations /// \return a list of viewer presentations, which contains an attribute result and diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 3fe190981..6d570d985 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -307,11 +307,17 @@ QIntList PartSet_WidgetSketchCreator::shapeTypes() const { QIntList aShapeTypes; if (myShapeTypes.length() > 1 && myIsUseChoice) { - aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCtrl->textValue())); + QStringList aTypes = myTypeCtrl->textValue().split("|", QString::SkipEmptyParts); + foreach(QString aType, aTypes) { + aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); + } } else { foreach(QString aType, myShapeTypes) { - aShapeTypes.append(ModuleBase_Tools::shapeType(aType)); + QStringList aSubTypes = aType.split("|", QString::SkipEmptyParts); + foreach(QString asubType, aSubTypes) { + aShapeTypes.append(ModuleBase_Tools::shapeType(asubType)); + } } } return aShapeTypes; -- 2.39.2