Contour of some lines creation.
this, SLOT(onMouseReleased(XGUI_ViewWindow*, QMouseEvent*)));
connect(aViewer, SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)),
this, SLOT(onMouseMoved(XGUI_ViewWindow*, QMouseEvent*)));
+ connect(aViewer, SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)),
+ this, SLOT(onKeyRelease(XGUI_ViewWindow*, QKeyEvent*)));
}
}
}
}
+void PartSet_Module::onKeyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent)
+{
+ ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+ PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (aPreviewOp) {
+ aPreviewOp->keyReleased(theEvent->key());
+ }
+}
+
void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ)
{
XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
class XGUI_ViewWindow;
class QMouseEvent;
+class QKeyEvent;
class PartSet_Listener;
class ModelAPI_Feature;
/// \param theEvent the mouse event
void onMouseMoved(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+ /// SLOT, that is called by the key in the viewer is clicked.
+ /// \param theWindow the window where the signal appears
+ /// \param theEvent the mouse event
+ void onKeyRelease(XGUI_ViewWindow*, QKeyEvent*);
+
/// SLOT, to apply to the current viewer the operation
/// \param theX the X projection value
/// \param theY the Y projection value
/// \param thePoint a 3D point clicked in the viewer
virtual void mouseMoved(const gp_Pnt& thePoint) {};
+ /// Processes the key pressed in the view
+ /// \param theKey a key value
+ virtual void keyReleased(const int theKey) {};
+
signals:
/// Signal about the feature construing is finished
/// \param theFeature the result feature
}
}
+void PartSet_OperationSketchLine::keyReleased(const int theKey)
+{
+ switch (theKey) {
+ case Qt::Key_Escape:
+ abort();
+ break;
+ case Qt::Key_Enter:
+ //myPointSelectionMode = myPointSelectionMode;
+ break;
+ default:
+ break;
+ }
+}
+
void PartSet_OperationSketchLine::startOperation()
{
PartSet_OperationSketchBase::startOperation();
/// Gives the current mouse point in the viewer
/// \param thePoint a point clicked in the viewer
virtual void mouseMoved(const gp_Pnt& thePoint);
+ /// Processes the key pressed in the view
+ /// \param theKey a key value
+ virtual void keyReleased(const int theKey);
signals:
/// signal about the sketch plane is selected
if (processViewPort(theEvent)) {
return true;
}
+ if (theEvent->type() == QEvent::KeyRelease) {
+ emit keyReleased(this, (QKeyEvent*) theEvent);
+ return true;
+ }
}
return QFrame::eventFilter(theObj, theEvent);
}