X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetPoint2D.cpp;h=21cef047dc80351fff5b0ca7a32d1aaa36d132b8;hb=6920ebc7d04391d5a1de785c8bed0301c3fab205;hp=b20f2e8d7065077c142cdde128f593c3f631d74f;hpb=4021ee9a0bbca04e0d2db98efa55eff30f03985a;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp index b20f2e8d7..21cef047d 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include #include #include @@ -33,10 +33,12 @@ ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent, : ModuleBase_ModelWidget(theParent, theData, theParentId) { myOptionParam = theData->getProperty(PREVIOUS_FEATURE_PARAM); - myGroupBox = new QGroupBox(QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME)), - theParent); + QString aPageName = QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME)); + myGroupBox = new QGroupBox(aPageName, theParent); + myGroupBox->setFlat(false); + QGridLayout* aGroupLay = new QGridLayout(myGroupBox); - aGroupLay->setContentsMargins(2, 0, 2, 0); + ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setColumnStretch(1, 1); { QLabel* aLabel = new QLabel(myGroupBox); @@ -66,8 +68,6 @@ ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent, connect(myYSpin, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged())); } - myXSpin->installEventFilter(this); - myYSpin->installEventFilter(this); } ModuleBase_WidgetPoint2D::~ModuleBase_WidgetPoint2D() @@ -107,11 +107,18 @@ bool ModuleBase_WidgetPoint2D::storeValue() const boost::shared_ptr aData = myFeature->data(); boost::shared_ptr aPoint = boost::dynamic_pointer_cast( aData->attribute(attributeID())); - + ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this; bool isBlocked = that->blockSignals(true); + bool isImmutable = aPoint->setImmutable(true); +#ifdef _DEBUG + std::string _attr_name = myAttributeID; + double _X = myXSpin->value(); + double _Y = myYSpin->value(); +#endif aPoint->setValue(myXSpin->value(), myYSpin->value()); updateObject(myFeature); + aPoint->setImmutable(isImmutable); that->blockSignals(isBlocked); return true; @@ -123,6 +130,11 @@ bool ModuleBase_WidgetPoint2D::restoreValue() boost::shared_ptr aPoint = boost::dynamic_pointer_cast( aData->attribute(attributeID())); +#ifdef _DEBUG + std::string _attr_name = myAttributeID; + double _X = aPoint->x(); + double _Y = aPoint->y(); +#endif bool isBlocked = this->blockSignals(true); myXSpin->setValue(aPoint->x()); myYSpin->setValue(aPoint->y()); @@ -144,22 +156,6 @@ QList ModuleBase_WidgetPoint2D::getControls() const return aControls; } -bool ModuleBase_WidgetPoint2D::eventFilter(QObject *theObject, QEvent *theEvent) -{ - if (theObject == myXSpin || theObject == myYSpin) { - if (theEvent->type() == QEvent::KeyRelease) { - QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent; - if (aKeyEvent && (aKeyEvent->key() == Qt::Key_Return || - aKeyEvent->key() == Qt::Key_Enter)) { - emit focusOutWidget(this); - } - emit keyReleased((QKeyEvent*) theEvent); - return true; - } - } - return ModuleBase_ModelWidget::eventFilter(theObject, theEvent); -} - bool ModuleBase_WidgetPoint2D::initFromPrevious(ObjectPtr theObject) { if (myOptionParam.length() == 0)