From: nds Date: Thu, 26 May 2016 10:42:47 +0000 (+0300) Subject: Issue #1508 Selection mode "objects" X-Git-Tag: V_2.3.1~52^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8eeebfb30e9c433edf90ab5dfdd12bf1651aaf7;p=modules%2Fshaper.git Issue #1508 Selection mode "objects" --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index c52b6c62b..932b3d5af 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -423,7 +423,7 @@ void ModuleBase_WidgetMultiSelector::updateSelectionName() } //******************************************************************** -QIntList ModuleBase_WidgetMultiSelector::getShapeTypes() const +QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const { QIntList aShapeTypes; @@ -431,12 +431,8 @@ QIntList ModuleBase_WidgetMultiSelector::getShapeTypes() const aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->currentText())); } else { - for (int i = 0, aCount = myTypeCombo->count(); i < aCount; i++) { - TopAbs_ShapeEnum aType = ModuleBase_Tools::shapeType(myTypeCombo->itemText(i)); - aShapeTypes.append(aType); - if (aType == TopAbs_SOLID) - aShapeTypes.append(TopAbs_COMPSOLID); - } + for (int i = 0, aCount = myTypeCombo->count(); i < aCount; i++) + aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->itemText(i))); } return aShapeTypes; } diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 946007d61..69ed362b6 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -121,7 +121,7 @@ protected: /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList getShapeTypes() const; + virtual QIntList shapeTypes() const; /// Set current shape type for selection void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType); diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index ebdd60a53..2912af30c 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -72,6 +72,17 @@ void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone) updateFocus(); } +//******************************************************************** +QIntList ModuleBase_WidgetSelector::getShapeTypes() const +{ + QIntList aShapeTypes = shapeTypes(); + if (aShapeTypes.contains(TopAbs_SOLID) || aShapeTypes.contains(TopAbs_SHAPE)) { + // it should be selectable for both, "solids" and "objects" types + aShapeTypes.append(TopAbs_COMPSOLID); + } + return aShapeTypes; +} + //******************************************************************** QList ModuleBase_WidgetSelector::getAttributeSelection() const { diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.h b/src/ModuleBase/ModuleBase_WidgetSelector.h index f39b74717..9db264010 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetSelector.h @@ -80,7 +80,11 @@ protected: /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList getShapeTypes() const = 0; + QIntList getShapeTypes() const; + + /// Retunrs a list of possible shape types + /// \return a list of shapes + virtual QIntList shapeTypes() const = 0; /// Computes and updates name of selected object in the widget // NDS: has body is temporary diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 013b89d3c..119329071 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -173,7 +173,7 @@ void ModuleBase_WidgetShapeSelector::updateFocus() } //******************************************************************** -QIntList ModuleBase_WidgetShapeSelector::getShapeTypes() const +QIntList ModuleBase_WidgetShapeSelector::shapeTypes() const { QIntList aShapeTypes; foreach(QString aType, myShapeTypes) { diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index 193819d8d..6ac087fbb 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -96,7 +96,7 @@ Q_OBJECT /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList getShapeTypes() const; + virtual QIntList shapeTypes() const; /// Get the shape from the attribute if the attribute contains a shape, e.g. selection attribute /// \return a shape diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 2f5d4bf7b..8daeb546d 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -208,7 +208,7 @@ void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelec } } -QIntList PartSet_WidgetSketchCreator::getShapeTypes() const +QIntList PartSet_WidgetSketchCreator::shapeTypes() const { QIntList aShapeTypes; foreach(QString aType, myShapeTypes) { diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index 57ba50eca..5290cef0a 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -100,7 +100,7 @@ protected: /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList getShapeTypes() const; + virtual QIntList shapeTypes() const; /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set