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
}
}
// 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);
} 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);
PartSet_Validators.h
PartSet_WidgetPoint2d.h
PartSet_WidgetConstraintShapeSelector.h
+ PartSet_WidgetEditor.h
PartSet_WidgetPoint2dDistance.h
PartSet_WidgetShapeSelector.h
PartSet_Filters.h
PartSet_WidgetSketchLabel.cpp
PartSet_Validators.cpp
PartSet_WidgetConstraintShapeSelector.cpp
+ PartSet_WidgetEditor.cpp
PartSet_WidgetPoint2d.cpp
PartSet_WidgetPoint2dDistance.cpp
PartSet_WidgetShapeSelector.cpp
#include <PartSet_WidgetPoint2dDistance.h>
#include <PartSet_WidgetShapeSelector.h>
#include <PartSet_WidgetConstraintShapeSelector.h>
+#include <PartSet_WidgetEditor.h>
#include <PartSet_SketcherMgr.h>
#include <ModuleBase_Operation.h>
#include <Events_Loop.h>
#include <Config_PropManager.h>
+#include <Config_Keywords.h>
#include <StdSelect_TypeOfFace.hxx>
#include <TopoDS_Vertex.hxx>
return true;
}
+bool PartSet_Module::isMouseOverWindow()
+{
+ return mySketchMgr->isMouseOverWindow();
+}
+
void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
{
ModuleBase_IPropertyPanel* aPanel = theOperation->propertyPanel();
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;
}
/// \return true if items are added and there is no necessity to provide standard menu
virtual bool addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& 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
/// \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; }
--- /dev/null
+// 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 <ModuleBase_IWorkshop.h>
+
+#include <Config_WidgetAPI.h>
+
+#include <QWidget>
+
+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<PartSet_Module*>(myWorkshop->module());
+ if (aModule->isMouseOverWindow())
+ return ModuleBase_WidgetDoubleValue::focusTo();
+ else {
+ ModuleBase_WidgetEditor::focusTo();
+ }
+}
--- /dev/null
+// 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 <ModuleBase_WidgetEditor.h>
+
+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
label="Last object" tooltip="Select line or arc" shape_types="edge">
</sketch_constraint_shape_selector>
- <doublevalue_editor label="Value" tooltip="Fillet radius" id="ConstraintValue" default="1" min="0" obligatory="0">
+ <doublevalue_editor label="Value" tooltip="Fillet radius" id="ConstraintValue" min="0">
<validator id="GeomValidators_Positive"/>
</doublevalue_editor>
</feature>