From e080d845f31ca0cc105f076a8d4050e88bb3518f Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 13 Jul 2016 22:50:55 +0300 Subject: [PATCH] We need to connect ToolTip signal from splines that already exists to ShowToolTip slot. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 8202161e1..bb03c893c 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -27,6 +27,7 @@ *************************************************************************/ #include "vpattern.h" +#include "mainwindow.h" #include "../vtools/tools/vdatatool.h" #include "../vtools/tools/vtooldetail.h" #include "../vtools/tools/vtooluniondetails.h" @@ -1914,8 +1915,16 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen const QString color = GetParametrString(domElement, AttrColor, ColorBlack); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0"); - VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, scene, this, data, parse, - Source::FromFile); + VToolSpline *spl = VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, scene, this, + data, parse, Source::FromFile); + + if (spl != nullptr) + { + MainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(spl, &VToolSpline::ToolTip, window, &MainWindow::ShowToolTip); + } + //Rewrite attribute formula. Need for situation when we have wrong formula. if (a1 != angle1 || a2 != angle2 || l1 != length1 || l2 != length2) { @@ -2095,7 +2104,16 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement l1 = length1; l2 = length2; - VToolSplinePath::Create(id, points, a1, a2, l1, l2, color, scene, this, data, parse, Source::FromFile); + VToolSplinePath *spl = VToolSplinePath::Create(id, points, a1, a2, l1, l2, color, scene, this, data, parse, + Source::FromFile); + + if (spl != nullptr) + { + MainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(spl, &VToolSplinePath::ToolTip, window, &MainWindow::ShowToolTip); + } + //Rewrite attribute formula. Need for situation when we have wrong formula. int count = 0; for (qint32 i = 0; i < num; ++i)