#include <ModuleBase_IViewer.h>
#include <ModuleBase_IViewWindow.h>
#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_WidgetEditor.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Events.h>
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<XGUI_ModuleConnector*>(theWshop);
XGUI_Workshop* aWorkshop = aConnector->workshop();
}
}
+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<ModuleBase_ModelWidget*> 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<XGUI_ModuleConnector*>(workshop());
}else
return 0;
}
+
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.