Fixed issue #698. Problem typing in new axis point for new piece.

(grafted from 8ad30021d46f5ddcd479b7ec1a9279a5185a2578)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-06-02 09:23:29 +03:00
parent f65ff76dd4
commit 4461caaf0f
4 changed files with 29 additions and 3 deletions

View File

@ -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.

View File

@ -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<VToolBasePoint *>(currentItem);
SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id))
{
case 0: // AttrName
SetPointName<VToolBasePoint>(value.toString());
break;
case 1: // QLatin1String("position")
currentItem->setPos(value.toPointF());
i->SetBasePointPos(value.toPointF());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
@ -1906,7 +1908,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item
AddPropertyObjectName(i, tr("Point label:"));
VPE::VPointFProperty* itemPosition = new VPE::VPointFProperty(tr("Position:"));
itemPosition->setValue(i->pos());
itemPosition->setValue(i->GetBasePointPos());
AddProperty(itemPosition, QLatin1String("position"));
}
@ -2408,7 +2410,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint()
{
VToolBasePoint *i = qgraphicsitem_cast<VToolBasePoint *>(currentItem);
idToProperty[AttrName]->setValue(i->name());
idToProperty[QLatin1String("position")]->setValue(i->pos());
idToProperty[QLatin1String("position")]->setValue(i->GetBasePointPos());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -249,6 +249,26 @@ void VToolBasePoint::decrementReferens()
}
}
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolBasePoint::GetBasePointPos() const
{
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
QPointF pos(qApp->fromPixel(p->x()), qApp->fromPixel(p->y()));
return pos;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBasePoint::SetBasePointPos(const QPointF &pos)
{
QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
p->setX(qApp->toPixel(pos.x()));
p->setY(qApp->toPixel(pos.y()));
QSharedPointer<VGObject> obj = qSharedPointerCast<VGObject>(p);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBasePoint::DeleteTool(bool ask)
{

View File

@ -63,6 +63,9 @@ public:
enum { Type = UserType + static_cast<int>(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;