From b820107b4dbe497b7aaad80d4d4428ae8cdb316a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Oct 2020 16:21:51 +0200 Subject: [PATCH] Notes for tool Base point. --- src/app/valentina/xml/vpattern.cpp | 18 +- src/app/valentina/xml/vpattern.h | 3 + src/libs/ifc/ifcdef.cpp | 1 + src/libs/ifc/ifcdef.h | 1 + .../dialogs/tools/dialogsinglepoint.cpp | 14 ++ .../vtools/dialogs/tools/dialogsinglepoint.h | 3 + .../vtools/dialogs/tools/dialogsinglepoint.ui | 169 +++++++++++------- .../flipping/vtoolflippingbyaxis.cpp | 4 +- .../flipping/vtoolflippingbyline.cpp | 4 +- .../drawTools/operation/vabstractoperation.h | 4 +- .../tools/drawTools/operation/vtoolmove.cpp | 4 +- .../drawTools/operation/vtoolrotation.cpp | 4 +- .../drawTools/toolcurve/vabstractspline.cpp | 6 - .../drawTools/toolcurve/vabstractspline.h | 5 +- .../drawTools/toolcurve/vtoolcubicbezier.h | 4 +- .../toolcurve/vtoolcubicbezierpath.h | 4 +- .../tooldoublepoint/vtooltruedarts.cpp | 2 + .../tooldoublepoint/vtooltruedarts.h | 4 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 2 + .../toolcut/vtoolcutspline.cpp | 2 + .../toolcut/vtoolcutsplinepath.cpp | 2 + .../toollinepoint/vtoolalongline.cpp | 2 + .../toollinepoint/vtoolbisector.cpp | 2 + .../toollinepoint/vtoolcurveintersectaxis.cpp | 2 + .../toollinepoint/vtoolendline.cpp | 2 + .../toollinepoint/vtoolheight.cpp | 2 + .../toollinepoint/vtoollineintersectaxis.cpp | 2 + .../toollinepoint/vtoolnormal.cpp | 2 + .../toollinepoint/vtoolshoulderpoint.cpp | 2 + .../toolsinglepoint/vtoolbasepoint.cpp | 12 +- .../toolsinglepoint/vtoolbasepoint.h | 1 - .../toolsinglepoint/vtoollineintersect.cpp | 2 + .../vtoolpointfromarcandtangent.cpp | 2 + .../vtoolpointfromcircleandtangent.cpp | 2 + .../toolsinglepoint/vtoolpointofcontact.cpp | 2 + .../vtoolpointofintersection.cpp | 2 + .../vtoolpointofintersectionarcs.cpp | 2 + .../vtoolpointofintersectioncircles.cpp | 2 + .../vtoolpointofintersectioncurves.cpp | 2 + .../toolsinglepoint/vtoolsinglepoint.h | 4 +- .../toolsinglepoint/vtooltriangle.cpp | 2 + src/libs/vtools/tools/drawTools/vdrawtool.cpp | 22 +++ src/libs/vtools/tools/drawTools/vdrawtool.h | 17 +- src/libs/vtools/tools/drawTools/vtoolline.cpp | 2 + src/libs/vtools/tools/drawTools/vtoolline.h | 4 +- 45 files changed, 255 insertions(+), 101 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 33d1a2828..1ceff1a82 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -1166,7 +1166,7 @@ void VPattern::PointsWithLineCommonAttributes(const QDomElement &domElement, VTo //--------------------------------------------------------------------------------------------------------------------- void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData) { - PointsCommonAttributes(domElement, initData.id, initData.mx, initData.my); + DrawPointsCommonAttributes(domElement, initData.id, initData.mx, initData.my, initData.notes); initData.name = GetParametrString(domElement, AttrName, QChar('A')); initData.showLabel = GetParametrBool(domElement, AttrShowLabel, trueStr); } @@ -1179,6 +1179,15 @@ void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0"))); } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my, + QString ¬es) +{ + DrawToolsCommonAttributes(domElement, id, notes); + mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("10.0"))); + my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0"))); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ParsePointElement parse point tag. @@ -4298,6 +4307,13 @@ void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id) id = GetParametrId(domElement); } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString ¬es) +{ + ToolsCommonAttributes(domElement, id); + notes = GetParametrEmptyString(domElement, AttrNotes); +} + //--------------------------------------------------------------------------------------------------------------------- QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wswitch-default") diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 88c5f17d0..2045d8964 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -169,9 +169,12 @@ private: void ParseIncrementsElement(const QDomNode& node, const Document &parse); void PrepareForParse(const Document &parse); void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id); + void DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString ¬es); void PointsWithLineCommonAttributes(const QDomElement &domElement, VToolLinePointInitData &initData); void PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData); void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my); + void DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my, + QString ¬es); void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool); template diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index e592264c6..a75a0492d 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -133,6 +133,7 @@ const QString AttrPlaceLabelType = QStringLiteral("placeLabelType"); const QString AttrVersion = QStringLiteral("version"); const QString AttrFirstToCountour = QStringLiteral("firstToCountour"); const QString AttrLastToCountour = QStringLiteral("lastToCountour"); +const QString AttrNotes = QStringLiteral("notes"); const QString TypeLineNone = QStringLiteral("none"); const QString TypeLineLine = QStringLiteral("hair"); diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index ae91d264e..995b67ebe 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -151,6 +151,7 @@ extern const QString AttrPlaceLabelType; extern const QString AttrVersion; extern const QString AttrFirstToCountour; extern const QString AttrLastToCountour; +extern const QString AttrNotes; extern const QString TypeLineNone; extern const QString TypeLineLine; diff --git a/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp b/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp index b3f5e21c7..0a1d0abec 100644 --- a/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp @@ -62,6 +62,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, quint32 toolId, QWi CheckPointLabel(this, ui->lineEditName, ui->labelEditName, pointName, this->data, flagName); CheckState(); }); + + ui->tabWidget->setCurrentIndex(0); } //--------------------------------------------------------------------------------------------------------------------- @@ -128,3 +130,15 @@ QString DialogSinglePoint::GetPointName() const { return pointName; } + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSinglePoint::SetNotes(const QString ¬es) +{ + ui->textEditToolNotes->setText(notes); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString DialogSinglePoint::GetNotes() const +{ + return ui->textEditToolNotes->toPlainText(); +} diff --git a/src/libs/vtools/dialogs/tools/dialogsinglepoint.h b/src/libs/vtools/dialogs/tools/dialogsinglepoint.h index 1536322fc..5d3fa2828 100644 --- a/src/libs/vtools/dialogs/tools/dialogsinglepoint.h +++ b/src/libs/vtools/dialogs/tools/dialogsinglepoint.h @@ -58,6 +58,9 @@ public: QString GetPointName() const; + void SetNotes(const QString ¬es); + QString GetNotes() const; + public slots: void mousePress(const QPointF &scenePos); protected: diff --git a/src/libs/vtools/dialogs/tools/dialogsinglepoint.ui b/src/libs/vtools/dialogs/tools/dialogsinglepoint.ui index d8bd7b484..8fdb229bd 100644 --- a/src/libs/vtools/dialogs/tools/dialogsinglepoint.ui +++ b/src/libs/vtools/dialogs/tools/dialogsinglepoint.ui @@ -9,8 +9,8 @@ 0 0 - 300 - 202 + 329 + 244 @@ -28,71 +28,108 @@ - - - - - Unique label - - - - - - Choose unique label. - - - - - - - - 0 - 0 - - - - Point label - - - - - - - - - - 241 - 129 - + + + 0 - - Coordinates on the sheet - - - Coordinates - - - - - - Y coordinate - - - - - - - X coordinate - - - - - - - - - - + + + Tool + + + + + + + + Unique label + + + + + + Choose unique label. + + + + + + + + 0 + 0 + + + + Point label + + + + + + + + + + 241 + 129 + + + + Coordinates on the sheet + + + Coordinates + + + + + + Y coordinate + + + + + + + X coordinate + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Notes + + + + + + + diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp index 66317733e..fb95ac1f3 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -233,6 +233,8 @@ void VToolFlippingByAxis::SaveDialog(QDomElement &domElement, QList &ol //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByAxis::ReadToolAttributes(const QDomElement &domElement) { + VAbstractFlipping::ReadToolAttributes(domElement); + m_originPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); m_axisType = static_cast(doc->GetParametrUInt(domElement, AttrAxisType, QChar('1'))); suffix = doc->GetParametrString(domElement, AttrSuffix); @@ -241,7 +243,7 @@ void VToolFlippingByAxis::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer &obj) { - VDrawTool::SaveOptions(tag, obj); + VAbstractFlipping::SaveOptions(tag, obj); doc->SetAttribute(tag, AttrType, ToolType); doc->SetAttribute(tag, AttrCenter, QString().setNum(m_originPointId)); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index e2bda983b..e21bd8093 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -220,6 +220,8 @@ void VToolFlippingByLine::SaveDialog(QDomElement &domElement, QList &ol //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByLine::ReadToolAttributes(const QDomElement &domElement) { + VAbstractFlipping::ReadToolAttributes(domElement); + m_firstLinePointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); m_secondLinePointId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR); suffix = doc->GetParametrString(domElement, AttrSuffix); @@ -228,7 +230,7 @@ void VToolFlippingByLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByLine::SaveOptions(QDomElement &tag, QSharedPointer &obj) { - VDrawTool::SaveOptions(tag, obj); + VAbstractFlipping::SaveOptions(tag, obj); doc->SetAttribute(tag, AttrType, ToolType); doc->SetAttribute(tag, AttrP1Line, QString().setNum(m_firstLinePointId)); diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h index ce120c4d8..fe352a7f8 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h @@ -50,10 +50,10 @@ struct DestinationItem bool showLabel; }; -struct VAbstractOperationInitData : VAbstractToolInitData +struct VAbstractOperationInitData : VDrawToolInitData { VAbstractOperationInitData() - : VAbstractToolInitData() + : VDrawToolInitData() {} QString suffix{}; diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index 37621d7a7..2298c35c4 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -489,6 +489,8 @@ void VToolMove::SaveDialog(QDomElement &domElement, QList &oldDependenc //--------------------------------------------------------------------------------------------------------------------- void VToolMove::ReadToolAttributes(const QDomElement &domElement) { + VAbstractOperation::ReadToolAttributes(domElement); + origPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); formulaAngle = doc->GetParametrString(domElement, AttrAngle, QChar('0')); formulaRotationAngle = doc->GetParametrString(domElement, AttrRotationAngle, QChar('0')); @@ -499,7 +501,7 @@ void VToolMove::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolMove::SaveOptions(QDomElement &tag, QSharedPointer &obj) { - VDrawTool::SaveOptions(tag, obj); + VAbstractOperation::SaveOptions(tag, obj); doc->SetAttribute(tag, AttrType, ToolType); doc->SetAttribute(tag, AttrAngle, formulaAngle); diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index b03cc7048..c689a78a0 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -369,6 +369,8 @@ void VToolRotation::SaveDialog(QDomElement &domElement, QList &oldDepen //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::ReadToolAttributes(const QDomElement &domElement) { + VAbstractOperation::ReadToolAttributes(domElement); + origPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); formulaAngle = doc->GetParametrString(domElement, AttrAngle, QChar('0')); suffix = doc->GetParametrString(domElement, AttrSuffix); @@ -377,7 +379,7 @@ void VToolRotation::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::SaveOptions(QDomElement &tag, QSharedPointer &obj) { - VDrawTool::SaveOptions(tag, obj); + VAbstractOperation::SaveOptions(tag, obj); doc->SetAttribute(tag, AttrType, ToolType); doc->SetAttribute(tag, AttrCenter, QString().setNum(origPointId)); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 39963cb20..26ea19822 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -322,12 +322,6 @@ void VAbstractSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsPathItem::mouseReleaseEvent(event); } -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement) -{ - Q_UNUSED(domElement) -} - //--------------------------------------------------------------------------------------------------------------------- void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer &obj) { diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h index f5f286175..62aa088a3 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h @@ -54,10 +54,10 @@ class VControlPointSpline; template class QSharedPointer; -struct VAbstractSplineInitData : VAbstractToolInitData +struct VAbstractSplineInitData : VDrawToolInitData { VAbstractSplineInitData() - : VAbstractToolInitData(), + : VDrawToolInitData(), color(ColorBlack), penStyle(TypeLineLine), approximationScale(defCurveApproximationScale) @@ -129,7 +129,6 @@ protected: virtual void keyReleaseEvent(QKeyEvent * event) override; virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) override; - virtual void ReadToolAttributes(const QDomElement &domElement) override; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) override; virtual void RefreshCtrlPoints(); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) override; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h index 457dcf64f..442ec4432 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h @@ -46,10 +46,10 @@ template class QSharedPointer; QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Weffc++") -struct VToolCubicBezierInitData : VAbstractToolInitData +struct VToolCubicBezierInitData : VDrawToolInitData { VToolCubicBezierInitData() - : VAbstractToolInitData(), + : VDrawToolInitData(), spline(nullptr) {} diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h index f272b5939..b2799f9a9 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h @@ -46,10 +46,10 @@ template class QSharedPointer; QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Weffc++") -struct VToolCubicBezierPathInitData : VAbstractToolInitData +struct VToolCubicBezierPathInitData : VDrawToolInitData { VToolCubicBezierPathInitData() - : VAbstractToolInitData(), + : VDrawToolInitData(), path(nullptr) {} diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index 8f9e93924..f19f5df6a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -306,6 +306,8 @@ void VToolTrueDarts::SaveOptions(QDomElement &tag, QSharedPointer &obj //--------------------------------------------------------------------------------------------------------------------- void VToolTrueDarts::ReadToolAttributes(const QDomElement &domElement) { + VToolDoublePoint::ReadToolAttributes(domElement); + baseLineP1Id = doc->GetParametrUInt(domElement, AttrBaseLineP1, NULL_ID_STR); baseLineP2Id = doc->GetParametrUInt(domElement, AttrBaseLineP2, NULL_ID_STR); dartP1Id = doc->GetParametrUInt(domElement, AttrDartP1, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h index a2c33077d..0d97b7505 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h @@ -44,10 +44,10 @@ template class QSharedPointer; -struct VToolTrueDartsInitData : VAbstractToolInitData +struct VToolTrueDartsInitData : VDrawToolInitData { VToolTrueDartsInitData() - : VAbstractToolInitData(), + : VDrawToolInitData(), p1id(NULL_ID), p2id(NULL_ID), baseLineP1Id(NULL_ID), diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 9231b893d..97441ad9b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -231,6 +231,8 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolCutArc::ReadToolAttributes(const QDomElement &domElement) { + VToolCut::ReadToolAttributes(domElement); + formula = doc->GetParametrString(domElement, AttrLength, QString()); curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 9e056c490..d187d095f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -230,6 +230,8 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer &obj //--------------------------------------------------------------------------------------------------------------------- void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement) { + VToolCut::ReadToolAttributes(domElement); + formula = doc->GetParametrString(domElement, AttrLength, QString()); curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index d37b00fa2..21cb37257 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -321,6 +321,8 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer //--------------------------------------------------------------------------------------------------------------------- void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement) { + VToolCut::ReadToolAttributes(domElement); + formula = doc->GetParametrString(domElement, AttrLength, QString()); curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 9e1cffc36..a239186f3 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -121,6 +121,8 @@ void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer &obj //--------------------------------------------------------------------------------------------------------------------- void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement) { + VToolLinePoint::ReadToolAttributes(domElement); + m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); formulaLength = doc->GetParametrString(domElement, AttrLength, QString()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp index f64b32ae5..93528d70a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -278,6 +278,8 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolBisector::ReadToolAttributes(const QDomElement &domElement) { + VToolLinePoint::ReadToolAttributes(domElement); + m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); formulaLength = doc->GetParametrString(domElement, AttrLength, QString()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index 1ea2ef245..5a38f665d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -278,6 +278,8 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointerGetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index 319cd5fa8..f738f2267 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -206,6 +206,8 @@ void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolEndLine::ReadToolAttributes(const QDomElement &domElement) { + VToolLinePoint::ReadToolAttributes(domElement); + m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); formulaLength = doc->GetParametrString(domElement, AttrLength, QString()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index 40c28fd76..2a12a584e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -237,6 +237,8 @@ void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolHeight::ReadToolAttributes(const QDomElement &domElement) { + VToolLinePoint::ReadToolAttributes(domElement); + m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index a154972ba..2f742d71f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -296,6 +296,8 @@ void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointerGetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp index 664574778..5b1c7e7b6 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -249,6 +249,8 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolNormal::ReadToolAttributes(const QDomElement &domElement) { + VToolLinePoint::ReadToolAttributes(domElement); + m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); formulaLength = doc->GetParametrString(domElement, AttrLength, QString()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index bd87e2e88..6c299c998 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -296,6 +296,8 @@ void VToolShoulderPoint::SaveOptions(QDomElement &tag, QSharedPointer //--------------------------------------------------------------------------------------------------------------------- void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement) { + VToolLinePoint::ReadToolAttributes(domElement); + m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); formulaLength = doc->GetParametrString(domElement, AttrLength, QString()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index b49d2c546..644359102 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -78,6 +78,7 @@ const QString VToolBasePoint::ToolType = QStringLiteral("single"); VToolBasePoint::VToolBasePoint (const VToolBasePointInitData &initData, QGraphicsItem * parent ) :VToolSinglePoint(initData.doc, initData.data, initData.id, parent), namePP(initData.nameActivPP) { + m_notes = initData.notes; m_baseColor = Qt::red; this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); @@ -96,6 +97,7 @@ void VToolBasePoint::setDialog() SCASSERT(not dialogTool.isNull()) const QSharedPointer p = VAbstractTool::data.GeometricObject(m_id); dialogTool->SetData(p->name(), static_cast(*p)); + dialogTool->SetNotes(m_notes); } //--------------------------------------------------------------------------------------------------------------------- @@ -267,6 +269,9 @@ void VToolBasePoint::SaveDialog(QDomElement &domElement, QList &oldDepe doc->SetAttribute(domElement, AttrName, name); doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(p.x()))); doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y()))); + + const QString notes = dialogTool->GetNotes(); + doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty()); } //--------------------------------------------------------------------------------------------------------------------- @@ -320,13 +325,6 @@ void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer &obj doc->SetAttribute(tag, AttrY, qApp->fromPixel(point->y())); } -//--------------------------------------------------------------------------------------------------------------------- -void VToolBasePoint::ReadToolAttributes(const QDomElement &domElement) -{ - Q_UNUSED(domElement) - // This tool doesn't need read attributes from file. -} - //--------------------------------------------------------------------------------------------------------------------- QString VToolBasePoint::MakeToolTip() const { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h index 740dd63f7..1b8bfbffe 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h @@ -95,7 +95,6 @@ protected: virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ) override; virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) override; virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) override; - virtual void ReadToolAttributes(const QDomElement &domElement) override; virtual void SetVisualization() override {} virtual QString MakeToolTip() const override; private slots: diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index 5a34b2776..78be9fbb5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -276,6 +276,8 @@ void VToolLineIntersect::SaveOptions(QDomElement &tag, QSharedPointer //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + p1Line1 = doc->GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR); p2Line1 = doc->GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR); p1Line2 = doc->GetParametrUInt(domElement, AttrP1Line2, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index f99b82692..4b1d305d8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -314,6 +314,8 @@ void VToolPointFromArcAndTangent::SaveOptions(QDomElement &tag, QSharedPointerGetParametrUInt(domElement, AttrArc, NULL_ID_STR); tangentPointId = doc->GetParametrUInt(domElement, AttrTangent, NULL_ID_STR); crossPoint = static_cast(doc->GetParametrUInt(domElement, AttrCrossPoint, QChar('1'))); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index 230df2356..db8ce5c4f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -307,6 +307,8 @@ void VToolPointFromCircleAndTangent::SaveOptions(QDomElement &tag, QSharedPointe //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromCircleAndTangent::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + circleCenterId = doc->GetParametrUInt(domElement, AttrCCenter, NULL_ID_STR); tangentPointId = doc->GetParametrUInt(domElement, AttrTangent, NULL_ID_STR); circleRadius = doc->GetParametrString(domElement, AttrCRadius); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index 9aa1ad7ac..3b938047f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -330,6 +330,8 @@ void VToolPointOfContact::SaveOptions(QDomElement &tag, QSharedPointer //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + arcRadius = doc->GetParametrString(domElement, AttrRadius, QString()); center = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index 76692a5fe..921d372bb 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -220,6 +220,8 @@ void VToolPointOfIntersection::SaveOptions(QDomElement &tag, QSharedPointerGetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 081c3b8d4..4b350a804 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -335,6 +335,8 @@ void VToolPointOfIntersectionArcs::SaveOptions(QDomElement &tag, QSharedPointer< //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + firstArcId = doc->GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR); secondArcId = doc->GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR); crossPoint = static_cast(doc->GetParametrUInt(domElement, AttrCrossPoint, QChar('1'))); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index 80cd70d7c..c1a091609 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -347,6 +347,8 @@ void VToolPointOfIntersectionCircles::SaveOptions(QDomElement &tag, QSharedPoint //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCircles::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + firstCircleCenterId = doc->GetParametrUInt(domElement, AttrC1Center, NULL_ID_STR); secondCircleCenterId = doc->GetParametrUInt(domElement, AttrC2Center, NULL_ID_STR); firstCircleRadius = doc->GetParametrString(domElement, AttrC1Radius); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index 9927b79d0..2548945d3 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -385,6 +385,8 @@ void VToolPointOfIntersectionCurves::SaveOptions(QDomElement &tag, QSharedPointe //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + firstCurveId = doc->GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR); secondCurveId = doc->GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR); vCrossPoint = static_cast(doc->GetParametrUInt(domElement, AttrVCrossPoint, QChar('1'))); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h index 6487f3e87..9a6f460fe 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h @@ -44,10 +44,10 @@ template class QSharedPointer; -struct VToolSinglePointInitData : VAbstractToolInitData +struct VToolSinglePointInitData : VDrawToolInitData { VToolSinglePointInitData() - : VAbstractToolInitData(), + : VDrawToolInitData(), name(), mx(5), my(10), diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index d71ee141c..fb7aaf5cc 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -319,6 +319,8 @@ void VToolTriangle::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolTriangle::ReadToolAttributes(const QDomElement &domElement) { + VToolSinglePoint::ReadToolAttributes(domElement); + axisP1Id = doc->GetParametrUInt(domElement, AttrAxisP1, NULL_ID_STR); axisP2Id = doc->GetParametrUInt(domElement, AttrAxisP2, NULL_ID_STR); firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.cpp b/src/libs/vtools/tools/drawTools/vdrawtool.cpp index 1abee64b1..bf587425c 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.cpp +++ b/src/libs/vtools/tools/drawTools/vdrawtool.cpp @@ -175,6 +175,7 @@ void VDrawTool::SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_UNUSED(obj) doc->SetAttribute(tag, VDomDocument::AttrId, m_id); + doc->SetAttributeOrRemoveIf(tag, AttrNotes, m_notes, m_notes.isEmpty()); } //--------------------------------------------------------------------------------------------------------------------- @@ -210,6 +211,12 @@ void VDrawTool::ReadAttributes() } } +//--------------------------------------------------------------------------------------------------------------------- +void VDrawTool::ReadToolAttributes(const QDomElement &domElement) +{ + m_notes = doc->GetParametrEmptyString(domElement, AttrNotes); +} + //--------------------------------------------------------------------------------------------------------------------- void VDrawTool::EnableToolMove(bool move) { @@ -280,3 +287,18 @@ bool VDrawTool::IsLabelVisible(quint32 id) const Q_UNUSED(id) return false; } + +//--------------------------------------------------------------------------------------------------------------------- +QString VDrawTool::GetNotes() const +{ + return m_notes; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VDrawTool::SetNotes(const QString ¬es) +{ + m_notes = notes; + + QSharedPointer obj = VAbstractTool::data.GetGObject(m_id); + SaveOption(obj); +} diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index b8de88334..da91c21cd 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -53,6 +53,16 @@ #include "../vgeometry/vpointf.h" #include "../vtools/undocommands/undogroup.h" +struct VDrawToolInitData : VAbstractToolInitData +{ + VDrawToolInitData() + : VAbstractToolInitData(), + notes() + {} + + QString notes; +}; + /** * @brief The VDrawTool abstract class for all draw tool. */ @@ -69,6 +79,9 @@ public: virtual bool IsLabelVisible(quint32 id) const; + QString GetNotes() const; + void SetNotes(const QString ¬es); + signals: void ChangedToolSelection(bool selected, quint32 object, quint32 tool); @@ -92,6 +105,8 @@ protected: /** @brief typeLine line type. */ QString m_lineType; + QString m_notes{}; + void AddToCalculation(const QDomElement &domElement); void AddDependence(QList &list, quint32 objectId) const; @@ -109,7 +124,7 @@ protected: bool CorrectDisable(bool disable, const QString &namePP) const; void ReadAttributes(); - virtual void ReadToolAttributes(const QDomElement &domElement)=0; + virtual void ReadToolAttributes(const QDomElement &domElement); virtual void ChangeLabelVisibility(quint32 id, bool visible); template diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index b054c4edd..25be58a81 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -407,6 +407,8 @@ void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolLine::ReadToolAttributes(const QDomElement &domElement) { + VDrawTool::ReadToolAttributes(domElement); + firstPoint = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); secondPoint = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.h b/src/libs/vtools/tools/drawTools/vtoolline.h index 669b0243f..f192b48c7 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.h +++ b/src/libs/vtools/tools/drawTools/vtoolline.h @@ -44,10 +44,10 @@ template class QSharedPointer; -struct VToolLineInitData : VAbstractToolInitData +struct VToolLineInitData : VDrawToolInitData { VToolLineInitData() - : VAbstractToolInitData(), + : VDrawToolInitData(), firstPoint(NULL_ID), secondPoint(NULL_ID), typeLine(TypeLineLine),