From 4461caaf0f1fe2c1abcd2730a5048c9dce8f952f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 2 Jun 2017 09:23:29 +0300 Subject: [PATCH] Fixed issue #698. Problem typing in new axis point for new piece. (grafted from 8ad30021d46f5ddcd479b7ec1a9279a5185a2578) --HG-- branch : develop --- ChangeLog.txt | 1 + .../core/vtooloptionspropertybrowser.cpp | 8 +++++--- .../toolsinglepoint/vtoolbasepoint.cpp | 20 +++++++++++++++++++ .../toolsinglepoint/vtoolbasepoint.h | 3 +++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5bcf4316d..82dd878d7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -15,6 +15,7 @@ - Added tooltip for tab Passmark. Explained meaning of check box "Show the second passmark on seam line". - [#696] Wrong grainline position on layout. - [#697] Incomplete Internal Path for Waist Dart. +- [#698] Problem typing in new axis point for new piece. # Version 0.5.0 May 9, 2017 - [#581] User can now filter input lists by keyword in function wizard. diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 0d7612e95..c83bfe7f2 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -863,13 +863,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VPE::VProperty *prop QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = propertyToId[property]; + VToolBasePoint *i = qgraphicsitem_cast(currentItem); + SCASSERT(i != nullptr) switch (PropertiesList().indexOf(id)) { case 0: // AttrName SetPointName(value.toString()); break; case 1: // QLatin1String("position") - currentItem->setPos(value.toPointF()); + i->SetBasePointPos(value.toPointF()); break; default: qWarning()<<"Unknown property type. id = "<setValue(i->pos()); + itemPosition->setValue(i->GetBasePointPos()); AddProperty(itemPosition, QLatin1String("position")); } @@ -2408,7 +2410,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint() { VToolBasePoint *i = qgraphicsitem_cast(currentItem); idToProperty[AttrName]->setValue(i->name()); - idToProperty[QLatin1String("position")]->setValue(i->pos()); + idToProperty[QLatin1String("position")]->setValue(i->GetBasePointPos()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index fc354e115..ba9334c9c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -249,6 +249,26 @@ void VToolBasePoint::decrementReferens() } } +//--------------------------------------------------------------------------------------------------------------------- +QPointF VToolBasePoint::GetBasePointPos() const +{ + const QSharedPointer p = VAbstractTool::data.GeometricObject(id); + QPointF pos(qApp->fromPixel(p->x()), qApp->fromPixel(p->y())); + return pos; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolBasePoint::SetBasePointPos(const QPointF &pos) +{ + QSharedPointer p = VAbstractTool::data.GeometricObject(id); + p->setX(qApp->toPixel(pos.x())); + p->setY(qApp->toPixel(pos.y())); + + QSharedPointer obj = qSharedPointerCast(p); + + SaveOption(obj); +} + //--------------------------------------------------------------------------------------------------------------------- void VToolBasePoint::DeleteTool(bool ask) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h index 1a02bb8c5..2c3e91648 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h @@ -63,6 +63,9 @@ public: enum { Type = UserType + static_cast(Tool::BasePoint)}; virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; virtual void decrementReferens() Q_DECL_OVERRIDE; + + QPointF GetBasePointPos() const; + void SetBasePointPos(const QPointF &pos); public slots: virtual void FullUpdateFromFile() Q_DECL_OVERRIDE; virtual void SetFactor(qreal factor) Q_DECL_OVERRIDE;