Salome HOME
Issue #143 Focus on "selector" widget allows to select another feature to apply the...
[modules/shaper.git] / src / PartSet / PartSet_OperationFeatureEdit.cpp
index 2bbc2229ed238733be0ff0aab80666cd4f6d2921..2036d55760d69e3bf540dd47eef848aafea8f1a8 100644 (file)
 
 using namespace std;
 
-PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent,
+PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId,
+                                                           QObject* theParent,
                                                            FeaturePtr theFeature)
-    : PartSet_OperationSketchBase(theId, theParent),
-      mySketch(theFeature),
+    : PartSet_OperationFeatureBase(theId, theParent, theFeature),
       myIsBlockedSelection(false)
 {
 }
@@ -49,26 +49,20 @@ PartSet_OperationFeatureEdit::~PartSet_OperationFeatureEdit()
 {
 }
 
-std::list<int> PartSet_OperationFeatureEdit::getSelectionModes(ObjectPtr theFeature) const
-{
-  return PartSet_OperationSketchBase::getSelectionModes(theFeature);
-}
-
 void PartSet_OperationFeatureEdit::initFeature(FeaturePtr theFeature)
 {
   setEditingFeature(theFeature);
 }
 
-FeaturePtr PartSet_OperationFeatureEdit::sketch() const
-{
-  return mySketch;
-}
-
-void PartSet_OperationFeatureEdit::mousePressed(
-    QMouseEvent* theEvent, Handle(V3d_View) theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
+                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
+  if(myActiveWidget && myActiveWidget->isViewerSelector()) {
+    // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased
+    PartSet_OperationFeatureBase::mousePressed(theEvent, theView, theSelected, theHighlighted);
+    return;
+  }
   ObjectPtr aObject;
   if (!theHighlighted.empty())
     aObject = theHighlighted.front().object();
@@ -131,10 +125,15 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_
 
 void PartSet_OperationFeatureEdit::mouseReleased(
     QMouseEvent* theEvent, Handle(V3d_View) theView,
-    const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
-    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
-  blockSelection(false);
+  if(myActiveWidget && myActiveWidget->isViewerSelector()) {
+    // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased
+    PartSet_OperationFeatureBase::mouseReleased(theEvent, theView, theSelected, theHighlighted);
+  } else {
+    blockSelection(false);
+  }
 }
 
 void PartSet_OperationFeatureEdit::mouseDoubleClick(
@@ -161,14 +160,6 @@ void PartSet_OperationFeatureEdit::mouseDoubleClick(
   }
 }
 
-void PartSet_OperationFeatureEdit::keyReleased(const int theKey)
-{
-  if (theKey == Qt::Key_Return || theKey == Qt::Key_Enter) {
-    commit();
-  } else
-    PartSet_OperationSketchBase::keyReleased(theKey);
-}
-
 void PartSet_OperationFeatureEdit::startOperation()
 {
   PartSet_OperationSketchBase::startOperation();