#include <Events_Loop.h>
+#include <QEvent>
#include <QWidget>
ModuleBase_ModelWidget::ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData,
static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(theObj, anEvent);
}
+
+void ModuleBase_ModelWidget::processFocus(QWidget* theWidget)
+{
+ theWidget->setFocusPolicy(Qt::StrongFocus);
+ theWidget->installEventFilter(this);
+ myFocusInWidgets.append(theWidget);
+}
+
+bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent)
+{
+ QWidget* aWidget = dynamic_cast<QWidget*>(theObject);
+ if (theEvent->type() == QEvent::FocusIn && myFocusInWidgets.contains(aWidget)) {
+ emit focusInWidget(this);
+ return true;
+ } else {
+ // pass the event on to the parent class
+ return QObject::eventFilter(theObject, theEvent);
+ }
+}
// Created: 25 Apr 2014
// Author: Natalia ERMOLAEVA
-#ifndef ModuleBase_ModelWidget_H
-#define ModuleBase_ModelWidget_H
+#ifndef MODULEBASE_MODELWIDGET_H
+#define MODULEBASE_MODELWIDGET_H
#include <ModuleBase.h>
/// \return a control list
virtual QList<QWidget*> getControls() const = 0;
+ /// FocusIn events processing
+ virtual bool eventFilter(QObject* theObject, QEvent *theEvent);
+
/// Returns the attribute name
/// \returns the string value
std::string attributeID() const
myFeature = theFeature;
}
+ /// Defines if it is supposed that the widget should interact with the viewer.
+ virtual bool isViewerSelector() { return false; }
+
signals:
/// The signal about widget values changed
void valuesChanged();
/// \param theAttributeName a name of the attribute
/// \param theEvent key release event
void keyReleased(QKeyEvent* theEvent);
+ /// The signal about the widget is get focus
+ /// \param theWidget the model base widget
+ void focusInWidget(ModuleBase_ModelWidget* theWidget);
/// The signal about the widget is lost focus
/// \param theWidget the model base widget
void focusOutWidget(ModuleBase_ModelWidget* theWidget);
void updateObject(ObjectPtr theObj) const;
+ /// Let the widget process FocusIn events
+ void processFocus(QWidget* theWidget);
+
std::string myAttributeID; /// the attribute name of the model feature
std::string myParentId; /// name of parent
FeaturePtr myFeature;
bool myIsComputedDefault;
+
+ private:
+ /// Contains a list of widgets that may accept focus
+ QList<QWidget*> myFocusInWidgets;
};
#endif
QString anObjName = QString::fromStdString(attributeID());
myEditor->setObjectName(anObjName);
myEditor->setReadOnly(true);
+ processFocus(myEditor);
aControlLay->addWidget(myEditor);
QString aTTip = QString::fromStdString(theData->widgetTooltip());
myEditor->setToolTip(aTTip);
-
aControlLay->addWidget(myEditor);
aControlLay->setStretch(1, 1);
}
class QWidget;
class QLabel;
class QLineEdit;
+class QToolButton;
/**\class ModuleBase_WidgetFeature
* \ingroup GUI
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
+ /// Defines if it is supposed that the widget should interact with the viewer.
+ virtual bool isViewerSelector() { return true; }
protected:
/// Fill the widget values by given point
return myObjectKinds;
}
+ protected:
ObjectPtr myObject; ///< the current widget feature
QStringList myObjectKinds; ///< the kinds of possible features
+ private:
QWidget* myContainer; /// the parent top control
QLabel* myLabel; /// the editor information label
QLineEdit* myEditor; ///< the feature editor to visualize the feature name
virtual bool storeValue() const;
virtual bool restoreValue();
+ /// Defines if it is supposed that the widget should interact with the viewer.
+ virtual bool isViewerSelector() { return true; }
protected:
/// Set the attribute
PartSet_OperationFeatureEditMulti.h
PartSet_OperationSketchBase.h
PartSet_OperationSketch.h
+ PartSet_OperationFeatureBase.h
PartSet_TestOCC.h
PartSet_Tools.h
PartSet_WidgetSketchLabel.h
PartSet_OperationFeatureEditMulti.cpp
PartSet_OperationSketchBase.cpp
PartSet_OperationSketch.cpp
+ PartSet_OperationFeatureBase.cpp
PartSet_TestOCC.cpp
PartSet_Tools.cpp
PartSet_WidgetSketchLabel.cpp
std::string aKind = aFeature ? aFeature->getKind() : "";
ModuleBase_Operation* anOperation = createOperation(theName, aKind);
- PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- if (aPreviewOp) {
+ PartSet_OperationSketchBase* aSketchOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (aSketchOp) {
XGUI_Selection* aSelection = myWorkshop->selector()->selection();
// Initialise operation with preliminary selection
std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
- aPreviewOp->initFeature(aFeature);
- aPreviewOp->initSelection(aSelected, aHighlighted);
+ aSketchOp->initFeature(aFeature);
+ aSketchOp->initSelection(aSelected, aHighlighted);
} else if (aFeature) {
anOperation->setEditingFeature(aFeature);
//Deactivate result of current feature in order to avoid its selection
--- /dev/null
+// File: PartSet_OperationFeatureBase.h
+// Created: 20 Apr 2014
+// Author: Natalia ERMOLAEVA
+
+#include <PartSet_OperationFeatureBase.h>
+
+#include <PartSet_Tools.h>
+#include <PartSet_OperationSketch.h>
+
+#include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Point.h>
+#include <SketchPlugin_Line.h>
+#include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Arc.h>
+#include <SketchPlugin_ConstraintDistance.h>
+#include <SketchPlugin_ConstraintLength.h>
+#include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_ConstraintParallel.h>
+#include <SketchPlugin_ConstraintPerpendicular.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
+
+#include <GeomAPI_Pnt2d.h>
+
+#include <ModuleBase_OperationDescription.h>
+#include <ModuleBase_WidgetPoint2D.h>
+#include <ModuleBase_WidgetValueFeature.h>
+#include <ModuleBase_ViewerPrs.h>
+
+#include <XGUI_Constants.h>
+
+#include <V3d_View.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS.hxx>
+#include <BRep_Tool.hxx>
+
+#ifdef _DEBUG
+#include <QDebug>
+#include <iostream>
+#endif
+
+#include <QMouseEvent>
+
+using namespace std;
+
+PartSet_OperationFeatureBase::PartSet_OperationFeatureBase(const QString& theId,
+ QObject* theParent,
+ FeaturePtr theFeature)
+ : PartSet_OperationSketchBase(theId, theParent),
+ mySketch(theFeature),
+ myActiveWidget(NULL)
+{
+}
+
+PartSet_OperationFeatureBase::~PartSet_OperationFeatureBase()
+{
+}
+
+void PartSet_OperationFeatureBase::initSelection(
+ const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+{
+ myPreSelection = theSelected;
+}
+
+void PartSet_OperationFeatureBase::initFeature(FeaturePtr theFeature)
+{
+ myInitFeature = theFeature;
+}
+
+FeaturePtr PartSet_OperationFeatureBase::sketch() const
+{
+ return mySketch;
+}
+
+void PartSet_OperationFeatureBase::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
+ const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+{
+ gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+ double aX = aPoint.X(), anY = aPoint.Y();
+
+ if (theSelected.empty()) {
+ PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+ } else {
+ ModuleBase_ViewerPrs aPrs = theSelected.front();
+ const TopoDS_Shape& aShape = aPrs.shape();
+ if (!aShape.IsNull()) {
+ if (aShape.ShapeType() == TopAbs_VERTEX) { // a point is selected
+ const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
+ if (!aVertex.IsNull()) {
+ aPoint = BRep_Tool::Pnt(aVertex);
+ PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+ PartSet_Tools::setConstraints(sketch(), feature(), myActiveWidget->attributeID(), aX, anY);
+ }
+ } else if (aShape.ShapeType() == TopAbs_EDGE) { // a line is selected
+ PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+ }
+ }
+ }
+ ObjectPtr aFeature;
+ if (!theSelected.empty()) {
+ ModuleBase_ViewerPrs aPrs = theSelected.front();
+ aFeature = aPrs.object();
+ } else {
+ aFeature = feature(); // for the widget distance only
+ }
+
+ bool isApplyed = setWidgetValue(aFeature, aX, anY);
+ if (isApplyed) {
+ flushUpdated();
+ emit activateNextWidget(myActiveWidget);
+ }
+ commit();
+}
+
+void PartSet_OperationFeatureBase::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
+{
+ myActiveWidget = theWidget;
+ if ((myPreSelection.size() > 0) && myActiveWidget) {
+ const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
+ ModuleBase_WidgetValueFeature aValue;
+ aValue.setObject(aPrs.object());
+ if (myActiveWidget->setValue(&aValue)) {
+ myPreSelection.remove(aPrs);
+ emit activateNextWidget(myActiveWidget);
+ }
+ }
+ if (myInitFeature && myActiveWidget) {
+ ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
+ if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
+ myInitFeature = FeaturePtr();
+ emit activateNextWidget(myActiveWidget);
+ }
+ }
+}
+
+bool PartSet_OperationFeatureBase::setWidgetValue(ObjectPtr theFeature, double theX, double theY)
+{
+ if (!myActiveWidget)
+ return false;
+ ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
+ aValue->setObject(theFeature);
+ aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
+ bool isApplyed = myActiveWidget->setValue(aValue);
+
+ delete aValue;
+ myIsModified = (myIsModified || isApplyed);
+ return isApplyed;
+}
--- /dev/null
+// File: PartSet_OperationFeatureBase.h
+// Created: 20 Apr 2014
+// Author: Natalia ERMOLAEVA
+
+#ifndef PARTSET_OPERATIONFEATUREBASE_H
+#define PARTSET_OPERATIONFEATUREBASE_H
+
+#include "PartSet.h"
+
+#include <PartSet_OperationSketchBase.h>
+#include <PartSet_Constants.h>
+
+#include <QObject>
+
+class GeomDataAPI_Point2D;
+class QMouseEvent;
+class QKeyEvent;
+
+/*!
+ \class PartSet_OperationFeatureBase
+ * \brief The operation for the sketch feature creation
+ */
+class PARTSET_EXPORT PartSet_OperationFeatureBase : public PartSet_OperationSketchBase
+{
+Q_OBJECT
+
+ public:
+ /// Constructor
+ /// \param theId the feature identifier
+ /// \param theParent the operation parent
+ /// \param theSketch the parent feature
+ PartSet_OperationFeatureBase(const QString& theId, QObject* theParent, FeaturePtr theSketch);
+ /// Destructor
+ virtual ~PartSet_OperationFeatureBase();
+
+ /// Initialisation of operation with preliminary selection
+ /// \param theSelected the list of selected presentations
+ /// \param theHighlighted the list of highlighted presentations
+ virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+
+ /// Initializes the operation with previously created feature. It is used in sequental operations
+ virtual void initFeature(FeaturePtr theFeature);
+
+ /// Returns the operation sketch feature
+ /// \returns the sketch instance
+ virtual FeaturePtr sketch() const;
+
+ /// Gives the current selected objects to be processed by the operation
+ /// \param theEvent the mouse event
+ /// \param theView a viewer to have the viewer the eye position
+ /// \param theSelected the list of selected presentations
+ /// \param theHighlighted the list of highlighted presentations
+ virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+ const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+
+
+ public slots:
+ /// Slots which listen the mode widget activation
+ /// \param theWidget the model widget
+ virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
+
+ protected:
+ /// Set value to the active widget
+ /// \param theFeature the feature
+ /// \param theX the horizontal coordinate
+ /// \param theY the vertical coordinate
+ /// \return true if the point is set
+ bool setWidgetValue(ObjectPtr theFeature, double theX, double theY);
+
+ protected:
+ FeaturePtr myInitFeature; ///< the initial feature
+ FeaturePtr mySketch; ///< the sketch of the feature
+
+ ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
+
+ std::list<ModuleBase_ViewerPrs> myPreSelection;
+};
+
+#endif
PartSet_OperationFeatureCreate::PartSet_OperationFeatureCreate(const QString& theId,
QObject* theParent,
FeaturePtr theFeature)
- : PartSet_OperationSketchBase(theId, theParent),
- mySketch(theFeature),
- myActiveWidget(0)
+ : PartSet_OperationFeatureBase(theId, theParent, theFeature)
{
}
return aModes;
}
-void PartSet_OperationFeatureCreate::initSelection(
- const std::list<ModuleBase_ViewerPrs>& theSelected,
- const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
-{
- myPreSelection = theSelected;
-}
-
-void PartSet_OperationFeatureCreate::initFeature(FeaturePtr theFeature)
+void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
{
- myInitFeature = theFeature;
+ double aX, anY;
+ gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+ PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+ setWidgetValue(feature(), aX, anY);
+ flushUpdated();
}
-FeaturePtr PartSet_OperationFeatureCreate::sketch() const
+void PartSet_OperationFeatureCreate::keyReleased(const int theKey)
{
- return mySketch;
+ switch (theKey) {
+ case Qt::Key_Return:
+ case Qt::Key_Enter: {
+ if (commit()) {
+ // it start a new line creation at a free point
+ restartOperation(feature()->getKind());
+ }
+ }
+ break;
+ default:
+ break;
+ }
}
-void PartSet_OperationFeatureCreate::mouseReleased(
- QMouseEvent* theEvent, Handle(V3d_View) theView,
- const std::list<ModuleBase_ViewerPrs>& theSelected,
- const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
+ const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
{
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
double aX = aPoint.X(), anY = aPoint.Y();
} else {
ModuleBase_ViewerPrs aPrs = theSelected.front();
const TopoDS_Shape& aShape = aPrs.shape();
- if (!aShape.IsNull())
- {
+ if (!aShape.IsNull()) {
if (aShape.ShapeType() == TopAbs_VERTEX) { // a point is selected
const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
if (!aVertex.IsNull()) {
}
} else if (aShape.ShapeType() == TopAbs_EDGE) { // a line is selected
PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
- // move to selected line
- if (feature()->getKind() == SketchPlugin_Line::ID()) {
- //FeaturePtr aFeature = aPrs.feature();
- //projectPointOnLine(aFeature, myPointSelectionMode, aPoint, theView, aX, anY);
- }
}
}
}
if (!theSelected.empty()) {
ModuleBase_ViewerPrs aPrs = theSelected.front();
aFeature = aPrs.object();
- } else
+ } else {
aFeature = feature(); // for the widget distance only
+ }
bool isApplyed = setWidgetValue(aFeature, aX, anY);
if (isApplyed) {
}
}
-void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
-{
- double aX, anY;
- gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
- PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
- setWidgetValue(feature(), aX, anY);
- flushUpdated();
-}
-
-void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
-{
- myActiveWidget = theWidget;
- if ((myPreSelection.size() > 0) && myActiveWidget) {
- const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
- ModuleBase_WidgetValueFeature aValue;
- aValue.setObject(aPrs.object());
- if (myActiveWidget->setValue(&aValue)) {
- myPreSelection.remove(aPrs);
- emit activateNextWidget(myActiveWidget);
- }
- }
- if (myInitFeature && myActiveWidget) {
- ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
- if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
- myInitFeature = FeaturePtr();
- emit activateNextWidget(myActiveWidget);
- }
- }
-}
-
-void PartSet_OperationFeatureCreate::keyReleased(const int theKey)
-{
- switch (theKey) {
- case Qt::Key_Return:
- case Qt::Key_Enter: {
- if (commit()) {
- // it start a new line creation at a free point
- restartOperation(feature()->getKind());
- }
- }
- break;
- default:
- break;
- }
-}
-
void PartSet_OperationFeatureCreate::activateNextToCurrentWidget()
{
emit activateNextWidget(myActiveWidget);
flushCreated();
return aNewFeature;
}
-
-bool PartSet_OperationFeatureCreate::setWidgetValue(ObjectPtr theFeature, double theX, double theY)
-{
- if (!myActiveWidget)
- return false;
- ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
- aValue->setObject(theFeature);
- aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
- bool isApplyed = myActiveWidget->setValue(aValue);
-
- delete aValue;
- myIsModified = (myIsModified || isApplyed);
- return isApplyed;
-}
#include "PartSet.h"
-#include <PartSet_OperationSketchBase.h>
+#include <PartSet_OperationFeatureBase.h>
#include <PartSet_Constants.h>
#include <QObject>
\class PartSet_OperationFeatureCreate
* \brief The operation for the sketch feature creation
*/
-class PARTSET_EXPORT PartSet_OperationFeatureCreate : public PartSet_OperationSketchBase
+class PARTSET_EXPORT PartSet_OperationFeatureCreate : public PartSet_OperationFeatureBase
{
Q_OBJECT
/// \return the boolean result
static bool canProcessKind(const std::string& theId);
- public:
/// Constructor
/// \param theId the feature identifier
/// \param theParent the operation parent
/// \return the selection mode
virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
- /// Initializes the operation with previously created feature. It is used in sequental operations
- virtual void initFeature(FeaturePtr theFeature);
-
- /// Initialisation of operation with preliminary selection
- /// \param theSelected the list of selected presentations
- /// \param theHighlighted the list of highlighted presentations
- virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
- const std::list<ModuleBase_ViewerPrs>& theHighlighted);
-
- /// Returns the operation sketch feature
- /// \returns the sketch instance
- virtual FeaturePtr sketch() const;
+ /// Gives the current mouse point in the viewer
+ /// \param thePoint a point clicked in the viewer
+ /// \param theEvent the mouse event
+ virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Gives the current selected objects to be processed by the operation
/// \param theEvent the mouse event
virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
const std::list<ModuleBase_ViewerPrs>& theSelected,
const std::list<ModuleBase_ViewerPrs>& theHighlighted);
- /// Gives the current mouse point in the viewer
- /// \param thePoint a point clicked in the viewer
- /// \param theEvent the mouse event
- virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Processes the key pressed in the view
/// \param theKey a key value
virtual void keyReleased(const int theKey);
+ /// alias for activateNextWidget(myActiveWidget);
virtual void activateNextToCurrentWidget();
- public slots:
- /// Slots which listen the mode widget activation
- /// \param theWidget the model widget
- virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
-
protected:
/// \brief Virtual method called when operation is started
/// Virtual method called when operation started (see start() method for more description)
/// Verifies whether this operator can be commited.
/// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
virtual bool canBeCommitted() const;
-
- protected:
- /// Set value to the active widget
- /// \param theFeature the feature
- /// \param theX the horizontal coordinate
- /// \param theY the vertical coordinate
- /// \return true if the point is set
- bool setWidgetValue(ObjectPtr theFeature, double theX, double theY);
-
- private:
- FeaturePtr myInitFeature; ///< the initial feature
- FeaturePtr mySketch; ///< the sketch of the feature
-
- ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
-
- std::list<ModuleBase_ViewerPrs> myPreSelection;
};
#endif
using namespace std;
-PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent,
+PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId,
+ QObject* theParent,
FeaturePtr theFeature)
- : PartSet_OperationSketchBase(theId, theParent),
- mySketch(theFeature),
+ : PartSet_OperationFeatureBase(theId, theParent, theFeature),
myIsBlockedSelection(false)
{
}
{
}
-std::list<int> PartSet_OperationFeatureEdit::getSelectionModes(ObjectPtr theFeature) const
-{
- return PartSet_OperationSketchBase::getSelectionModes(theFeature);
-}
-
void PartSet_OperationFeatureEdit::initFeature(FeaturePtr theFeature)
{
setEditingFeature(theFeature);
}
-FeaturePtr PartSet_OperationFeatureEdit::sketch() const
-{
- return mySketch;
-}
-
-void PartSet_OperationFeatureEdit::mousePressed(
- QMouseEvent* theEvent, Handle(V3d_View) theView,
- const std::list<ModuleBase_ViewerPrs>& theSelected,
- const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
+ const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& theHighlighted)
{
+ if(myActiveWidget && myActiveWidget->isViewerSelector()) {
+ // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased
+ PartSet_OperationFeatureBase::mousePressed(theEvent, theView, theSelected, theHighlighted);
+ return;
+ }
ObjectPtr aObject;
if (!theHighlighted.empty())
aObject = theHighlighted.front().object();
void PartSet_OperationFeatureEdit::mouseReleased(
QMouseEvent* theEvent, Handle(V3d_View) theView,
- const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
- const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+ const std::list<ModuleBase_ViewerPrs>& theSelected,
+ const std::list<ModuleBase_ViewerPrs>& theHighlighted)
{
- blockSelection(false);
+ if(myActiveWidget && myActiveWidget->isViewerSelector()) {
+ // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased
+ PartSet_OperationFeatureBase::mouseReleased(theEvent, theView, theSelected, theHighlighted);
+ } else {
+ blockSelection(false);
+ }
}
void PartSet_OperationFeatureEdit::mouseDoubleClick(
#include "PartSet.h"
-#include <PartSet_OperationSketchBase.h>
+#include <PartSet_OperationFeatureBase.h>
#include <QObject>
class QMouseEvent;
\class PartSet_OperationFeatureEdit
* \brief The operation for the sketch feature creation
*/
-class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationSketchBase
+class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationFeatureBase
{
Q_OBJECT
/// Struct to define gp point, with the state is the point is initialized
/// Constructor
Point()
{
+ myIsInitialized = false;
}
/// Constructor
/// \param thePoint the point
/// Destructor
virtual ~PartSet_OperationFeatureEdit();
- /// Returns the operation local selection mode
- /// \param theFeature the feature object to get the selection mode
- /// \return the selection mode
- virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
-
/// Initializes the operation with previously created feature. It is used in sequental operations
virtual void initFeature(FeaturePtr theFeature);
- /// Returns the operation sketch feature
- /// \returns the sketch instance
- virtual FeaturePtr sketch() const;
-
/// Processes the mouse pressed in the point
/// \param theEvent the mouse event
/// \param theView a viewer to have the viewer the eye position
void sendFeatures();
private:
- FeaturePtr mySketch; ///< the sketch feature
Point myCurPoint; ///< the current 3D point clicked or moved
bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
};
connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), this,
SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
-
- //connect(*anIt, SIGNAL(activated(ModuleBase_ModelWidget*)),
- // this, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)));
+ connect(*anIt, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)),
+ this, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)));
ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast<ModuleBase_WidgetPoint2D*>(*anIt);
if (aPointWidget)