From: nds Date: Thu, 2 Apr 2015 12:56:03 +0000 (+0300) Subject: Issue #422 - Application hangs up when apply Fillet constraint on preselected segments X-Git-Tag: V_1.1.0~57^2~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5e455123d32f4d42a3e0b48603e9ee614bd28913;p=modules%2Fshaper.git Issue #422 - Application hangs up when apply Fillet constraint on preselected segments Do not show an editor control if the mouse is out of the viewer. So, for creation a fillet by preselection, the double value control is active --- diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 084ba04bf..68dd13221 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -239,12 +239,12 @@ void ModuleBase_Operation::activateByPreselection() } } // 2. ignore not obligatory widgets - for (; aWIt != aWidgets.constEnd(); ++aWIt) { + /*for (; aWIt != aWidgets.constEnd(); ++aWIt) { aWgt = (*aWIt); if (aWgt && aWgt->isObligatory()) continue; aFilledWgt = aWgt; - } + }*/ // 3. activate the next obligatory widget myPropertyPanel->activateNextWidget(aFilledWgt); diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index 93c3e7271..6925ee993 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -132,9 +132,6 @@ ModuleBase_ModelWidget* ModuleBase_WidgetFactory } else if (theType == WDG_BOOLVALUE) { result = new ModuleBase_WidgetBoolValue(theParent, myWidgetApi, myParentId); - } else if (theType == WDG_DOUBLEVALUE_EDITOR) { - result = new ModuleBase_WidgetEditor(theParent, myWidgetApi, myParentId); - } else if (theType == WDG_FILE_SELECTOR) { result = new ModuleBase_WidgetFileSelector(theParent, myWidgetApi, myParentId); diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index d10a13c9f..59affd8ca 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -13,6 +13,7 @@ SET(PROJECT_HEADERS PartSet_Validators.h PartSet_WidgetPoint2d.h PartSet_WidgetConstraintShapeSelector.h + PartSet_WidgetEditor.h PartSet_WidgetPoint2dDistance.h PartSet_WidgetShapeSelector.h PartSet_Filters.h @@ -26,6 +27,7 @@ SET(PROJECT_SOURCES PartSet_WidgetSketchLabel.cpp PartSet_Validators.cpp PartSet_WidgetConstraintShapeSelector.cpp + PartSet_WidgetEditor.cpp PartSet_WidgetPoint2d.cpp PartSet_WidgetPoint2dDistance.cpp PartSet_WidgetShapeSelector.cpp diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 4c6856835..f62c677a2 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,7 @@ #include #include +#include #include #include @@ -319,6 +321,11 @@ bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMapisMouseOverWindow(); +} + void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) { ModuleBase_IPropertyPanel* aPanel = theOperation->propertyPanel(); @@ -494,7 +501,9 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th new PartSet_WidgetConstraintShapeSelector(theParent, workshop(), theWidgetApi, theParentId); aConstraintShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aConstraintShapeSelectorWgt; - } + } if (theType == WDG_DOUBLEVALUE_EDITOR) { + aWgt = new PartSet_WidgetEditor(theParent, workshop(), theWidgetApi, theParentId); + } return aWgt; } diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 5264352dc..904175b13 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -107,6 +107,10 @@ public: /// \return true if items are added and there is no necessity to provide standard menu virtual bool addViewerItems(QMenu* theMenu, const QMap& theStdActions) const; + /// Returns whether the mouse enter the viewer's window + /// \return true if items are added and there is no necessity to provide standard menu + bool isMouseOverWindow(); + public slots: /// SLOT, that is called by no more widget signal emitted by property panel /// Set a specific flag to restart the sketcher operation diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index aad09ef0f..6f30ea45a 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -102,6 +102,8 @@ public: /// \return a boolean value static bool isDistanceOperation(ModuleBase_Operation* theOperation); + bool isMouseOverWindow() { return myIsMouseOverWindow; } + /// Returns current Sketch feature/ Returns NULL if there is no launched sketch operation CompositeFeaturePtr activeSketch() const { return myCurrentSketch; } diff --git a/src/PartSet/PartSet_WidgetEditor.cpp b/src/PartSet/PartSet_WidgetEditor.cpp new file mode 100644 index 000000000..66ed150b8 --- /dev/null +++ b/src/PartSet/PartSet_WidgetEditor.cpp @@ -0,0 +1,31 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: PartSet_WidgetShapeSelector.cpp +// Created: 27 Nov 2014 +// Author: Vitaly Smetannikov + +#include "PartSet_WidgetEditor.h" +#include "PartSet_Module.h" + +#include + +#include + +#include + +PartSet_WidgetEditor::PartSet_WidgetEditor(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, + const Config_WidgetAPI* theData, + const std::string& theParentId) + : ModuleBase_WidgetEditor(theParent, theData, theParentId), myWorkshop(theWorkshop) +{ +} + +bool PartSet_WidgetEditor::focusTo() +{ + PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); + if (aModule->isMouseOverWindow()) + return ModuleBase_WidgetDoubleValue::focusTo(); + else { + ModuleBase_WidgetEditor::focusTo(); + } +} diff --git a/src/PartSet/PartSet_WidgetEditor.h b/src/PartSet/PartSet_WidgetEditor.h new file mode 100644 index 000000000..a4f611146 --- /dev/null +++ b/src/PartSet/PartSet_WidgetEditor.h @@ -0,0 +1,45 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: PartSet_WidgetShapeSelector.h +// Created: 27 Nov 2014 +// Author: Vitaly Smetannikov + + +#ifndef PartSet_WidgetEditor_H +#define PartSet_WidgetEditor_H + +#include "PartSet.h" + +#include + +class ModuleBase_IWorkshop; + +/** +* \ingroup Modules +* Customosation of ModuleBase_WidgetEditor in order to do not show the editor value if the mouse +* cursor is not over the OCC window +*/ +class PARTSET_EXPORT PartSet_WidgetEditor : public ModuleBase_WidgetEditor +{ +Q_OBJECT + public: + /// Constructor + /// \param theParent the parent object + /// \param theWorkshop instance of workshop interface + /// \param theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent of the current attribute + PartSet_WidgetEditor(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, + const Config_WidgetAPI* theData, const std::string& theParentId); + + virtual ~PartSet_WidgetEditor() {} + + /// Activates the editor control only in case if the mouse over the OCC window, otherwise + /// set focus to the usual double value control + /// \return the state whether the widget can accept the focus + virtual bool focusTo(); + +private: + ModuleBase_IWorkshop* myWorkshop; // the current workshop +}; + +#endif \ No newline at end of file diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index caeb92d8d..f2bce5f32 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -227,7 +227,7 @@ label="Last object" tooltip="Select line or arc" shape_types="edge"> - +