]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update commands state on any selection (not only in viewer)
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 12 Jan 2017 15:03:25 +0000 (18:03 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 12 Jan 2017 15:03:25 +0000 (18:03 +0300)
src/PartSet/PartSet_Validators.cpp
src/XGUI/XGUI_ActionsMgr.cpp
src/XGUI/XGUI_Selection.cpp

index da35eb489e393007fd0d3b3a549a2d4a54f2f1d1..e415933371b447a04b8bd58e0ba4fb38cd5b57fd 100755 (executable)
@@ -202,9 +202,8 @@ bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection,
       if (aObj.get()) {
         FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
         if (aFeature.get()) {
-          std::shared_ptr<SketchPlugin_Feature> aSketch =
-            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
-          if (aSketch.get())
+          CompositeFeaturePtr aComp = ModelAPI_Tools::compositeOwner(aFeature);
+          if (aComp.get() && (aComp->getKind() == SketchPlugin_Sketch::ID()))
             aCount++;
         }
       }
index 26e33d3e2cc51f542871b3880c4f26c80aafcf1a..b86390dda0be144e41f554fb743d31eb8d3a36ed 100644 (file)
@@ -101,7 +101,8 @@ void XGUI_ActionsMgr::updateCommandsStatus()
 {
   setAllEnabled();
   XGUI_Selection* aSelection = myWorkshop->selector()->selection();
-  if (aSelection->getSelected(ModuleBase_ISelection::Viewer).size() > 0)
+  //if (aSelection->getSelected(ModuleBase_ISelection::Viewer).size() > 0)
+  if (aSelection->getSelected().size() > 0)
     updateOnViewSelection();
 
   FeaturePtr anActiveFeature = FeaturePtr();
index 56019f8aac06b357162b8a007bef65c445402dbc..36849ab9eb47bbb99184d0d0edfc513b1bf78fae 100644 (file)
@@ -273,7 +273,9 @@ QList<ModuleBase_ViewerPrsPtr> XGUI_Selection::getHighlighted() const
 
 QObjectPtrList XGUI_Selection::selectedObjects() const
 {
-  return myWorkshop->objectBrowser()->selectedObjects();
+  if (myWorkshop->objectBrowser())
+    return myWorkshop->objectBrowser()->selectedObjects();
+  return QObjectPtrList();
 }
 
 void XGUI_Selection::setSelectedObjects( const QObjectPtrList& theObjects ) const