#include "PartSet_WidgetPoint2d.h"
#include <PartSet_Tools.h>
#include <PartSet_Module.h>
-#include <PartSet_LockApplyMgr.h>
#include <ModuleBase_ParamSpinBox.h>
#include <ModuleBase_Tools.h>
static QStringList MyFeaturesForCoincedence;
-//#define APPLY_BY_ENTER_OR_TAB
-
PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData,
<< SketchPlugin_Point::ID().c_str()
<< SketchPlugin_Circle::ID().c_str();
}
- myLockApplyMgr = new PartSet_LockApplyMgr(theParent, myWorkshop);
// the control should accept the focus, so the boolen flag is corrected to be true
myIsObligatory = true;
myXSpin->setToolTip(tr("X"));
aGroupLay->addWidget(myXSpin, 0, 1);
-#ifdef APPLY_BY_ENTER_OR_TAB
- // Apply widget value change by enter/tab event.
- connect(myXSpin, SIGNAL(editingFinished()), this, SLOT(onValuesChanged()));
-#else
- connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged()));
-#endif
+ connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
}
{
QLabel* aLabel = new QLabel(myGroupBox);
myYSpin->setToolTip(tr("Y"));
aGroupLay->addWidget(myYSpin, 1, 1);
-#ifdef APPLY_BY_ENTER_OR_TAB
- // Apply widget value change by enter/tab event.
- connect(myYSpin, SIGNAL(editingFinished()), this, SLOT(onValuesChanged()));
-#else
- connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged()));
-#endif
+ connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
}
QVBoxLayout* aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
setLayout(aLayout);
}
-bool PartSet_WidgetPoint2D::reset()
+bool PartSet_WidgetPoint2D::resetCustom()
{
bool aDone = false;
if (!isUseReset() || isComputedDefault() || myXSpin->hasVariable() || myYSpin->hasVariable()) {
aModes << TopAbs_VERTEX;
aModes << TopAbs_EDGE;
myWorkshop->activateSubShapesSelection(aModes);
-
- myLockApplyMgr->activate();
}
bool PartSet_WidgetPoint2D::canBeActivatedByMove()
void PartSet_WidgetPoint2D::deactivate()
{
+ ModuleBase_ModelWidget::deactivate();
ModuleBase_IViewer* aViewer = myWorkshop->viewer();
disconnect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
myWorkshop->deactivateSubShapesSelection();
-
- myLockApplyMgr->deactivate();
}
bool PartSet_WidgetPoint2D::getPoint2d(const Handle(V3d_View)& theView,
double aX, anY;
PartSet_Tools::convertTo2D(aPoint, mySketch, theWnd->v3dView(), aX, anY);
+ // we need to block the value state change
+ bool isBlocked = blockValueState(true);
setPoint(aX, anY);
+ blockValueState(isBlocked);
+ setValueState(ModifiedInViewer);
}
double PartSet_WidgetPoint2D::x() const
return aPointIsFound;
}
-void PartSet_WidgetPoint2D::onValuesChanged()
+/*void PartSet_WidgetPoint2D::onValuesChanged()
{
- myLockApplyMgr->valuesChanged();
emit valuesChanged();
+}*/
+
+bool PartSet_WidgetPoint2D::processEnter()
+{
+ bool isModified = myXSpin->isModified() || myYSpin->isModified();
+ if (isModified) {
+ bool isXModified = myXSpin->isModified();
+ emit valuesChanged();
+ //onValuesChanged();
+ myXSpin->clearModified();
+ myYSpin->clearModified();
+ if (isXModified)
+ myXSpin->selectAll();
+ else
+ myYSpin->selectAll();
+ }
+ return isModified;
}