From: vsv Date: Mon, 8 Dec 2014 16:05:55 +0000 (+0300) Subject: Provide edit of dimension value on double click X-Git-Tag: V_0.6.0^2^2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1ddbb33336cc4c1b49fdde4a48f57ebc91dea9eb;p=modules%2Fshaper.git Provide edit of dimension value on double click --- diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 0a15d04b6..cf0e748db 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -304,8 +304,9 @@ bool ModuleBase_WidgetShapeSelector::setSelection(ModuleBase_ViewerPrs theValue) if (isValid(aObject, aShape)) { setObject(aObject, aShape); emit focusOutWidget(this); + return true; } - return true; + return false; } //******************************************************************** diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 5641f0555..7ecd6033b 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -106,6 +107,9 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), this, SLOT(onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*)), + this, SLOT(onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*))); + XGUI_ModuleConnector* aConnector = dynamic_cast(theWshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); @@ -526,6 +530,29 @@ void PartSet_Module::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* t } } +void PartSet_Module::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) +{ + ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + if (aOperation->isEditOperation()) { + std::string aId = aOperation->id().toStdString(); + if ((aId == SketchPlugin_ConstraintLength::ID()) || + (aId == SketchPlugin_ConstraintDistance::ID()) || + (aId == SketchPlugin_ConstraintRadius::ID())) + { + // Activate dimension value editing on double click + ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + QList aWidgets = aPanel->modelWidgets(); + // Find corresponded widget to activate value editing + foreach (ModuleBase_ModelWidget* aWgt, aWidgets) { + if (aWgt->attributeID() == "ConstraintValue") { + aWgt->focusTo(); + return; + } + } + } + } +} + void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) { XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); @@ -635,3 +662,4 @@ QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* }else return 0; } + diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 42619830d..bf6129997 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -69,19 +69,24 @@ protected slots: virtual void onSelectionChanged(); /// SLOT, that is called by mouse press in the viewer. - /// The mouse released point is sent to the current operation to be processed. + /// \param theWnd - the window where the event happens /// \param theEvent the mouse event void onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); /// SLOT, that is called by mouse release in the viewer. - /// The mouse released point is sent to the current operation to be processed. + /// \param theWnd - the window where the event happens /// \param theEvent the mouse event - virtual void onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + void onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); /// SLOT, that is called by mouse move in the viewer. - /// The mouse moved point is sent to the current operation to be processed. + /// \param theWnd - the window where the event happens + /// \param theEvent the mouse event + void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + + /// SLOT, that is called by mouse double click in the viewer. + /// \param theWnd - the window where the event happens /// \param theEvent the mouse event - virtual void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + void onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); /// SLOT, that is called by key release in the viewer. /// The mouse moved point is sent to the current operation to be processed.