From 01f66d3c347473158f12c611380f86a356816536 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sun, 3 Jul 2016 07:50:14 +0300 Subject: [PATCH 1/8] Resolved issue #461. Improve feature: Add a keyboard shortcut for getting pure 45, 90, 135, 180, 225, 270, 315 and 0 degree angles for all tools. --HG-- branch : feature --- .../vtools/tools/drawTools/toolcurve/vabstractspline.cpp | 8 ++++++++ .../vtools/tools/drawTools/toolcurve/vabstractspline.h | 1 + src/libs/vtools/visualization/line/visline.cpp | 2 +- src/libs/vtools/visualization/line/visline.h | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 57faed240..2bcfba7c3 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -261,6 +261,10 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin if (position == SplinePointPosition::FirstPoint) { QLineF line(spline.GetP1(), pos); + if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier) + { + line.setAngle(VisLine::CorrectAngle(line.angle())); + } qreal newAngle1 = line.angle(); QString newAngle1F = QString().setNum(newAngle1); @@ -287,6 +291,10 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin else { QLineF line(spline.GetP4(), pos); + if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier) + { + line.setAngle(VisLine::CorrectAngle(line.angle())); + } qreal newAngle2 = line.angle(); QString newAngle2F = QString().setNum(newAngle2); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h index 148d499b0..5b77b1dc9 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h @@ -30,6 +30,7 @@ #define VABSTRACTSPLINE_H #include "../vdrawtool.h" +#include "visualization/line/visline.h" #include diff --git a/src/libs/vtools/visualization/line/visline.cpp b/src/libs/vtools/visualization/line/visline.cpp index f8ccb91ce..7a245acdf 100644 --- a/src/libs/vtools/visualization/line/visline.cpp +++ b/src/libs/vtools/visualization/line/visline.cpp @@ -43,7 +43,7 @@ VisLine::~VisLine() {} //--------------------------------------------------------------------------------------------------------------------- -qreal VisLine::CorrectAngle(const qreal &angle) const +qreal VisLine::CorrectAngle(const qreal &angle) { qreal ang = angle; if (angle > 360) diff --git a/src/libs/vtools/visualization/line/visline.h b/src/libs/vtools/visualization/line/visline.h index 75c4783d6..80b2ca141 100644 --- a/src/libs/vtools/visualization/line/visline.h +++ b/src/libs/vtools/visualization/line/visline.h @@ -44,8 +44,8 @@ public: virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Vis::Line)}; + static qreal CorrectAngle(const qreal &angle); protected: - qreal CorrectAngle(const qreal &angle) const; QPointF Ray(const QPointF &firstPoint, const qreal &angle) const; QPointF Ray(const QPointF &firstPoint) const; QLineF Axis(const QPointF &p, const qreal &angle) const; From 2cf22753650a69a09be44365f0cdbbb11b9aa614 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 13 Jul 2016 14:05:37 +0300 Subject: [PATCH 2/8] Added ToolTip for editing simple curve. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 1 + src/libs/vtools/tools/vabstracttool.h | 3 +++ src/libs/vtools/visualization/path/vistoolspline.cpp | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 3de1c204c..a7995d608 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -698,6 +698,7 @@ void MainWindow::ClosedDialogWithApply(int result) { VDrawTool *vtool= static_cast(dialogTool->GetAssociatedTool()); vtool->DialogLinkDestroy(); + connect(vtool, &VDrawTool::ToolTip, this, &MainWindow::ShowToolTip); } ArrowTool(); } diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index 8126fdfb8..526d03936 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -95,6 +95,8 @@ signals: * @brief FullUpdateTree emit if need reparse pattern file. */ void LiteUpdateTree(const Document &parse); + + void ToolTip(const QString &toolTip); protected: /** @brief doc dom document container */ VAbstractPattern *doc; @@ -166,6 +168,7 @@ inline void VAbstractTool::AddVisualization() scene->addItem(visual); vis = visual; + connect(vis, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);}); } #endif // VABSTRACTTOOL_H diff --git a/src/libs/vtools/visualization/path/vistoolspline.cpp b/src/libs/vtools/visualization/path/vistoolspline.cpp index 3c19651b7..b135f9009 100644 --- a/src/libs/vtools/visualization/path/vistoolspline.cpp +++ b/src/libs/vtools/visualization/path/vistoolspline.cpp @@ -66,7 +66,9 @@ VisToolSpline::VisToolSpline(const VContainer *data, QGraphicsItem *parent) //--------------------------------------------------------------------------------------------------------------------- VisToolSpline::~VisToolSpline() -{} +{ + emit ToolTip(""); +} //--------------------------------------------------------------------------------------------------------------------- void VisToolSpline::RefreshGeometry() @@ -150,6 +152,8 @@ void VisToolSpline::RefreshGeometry() { VSpline spline(*first, *second, angle1, angle2, kAsm1, kAsm2, kCurve); DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap); + Visualization::toolTip = tr("Use Shift for sticking angle!"); + emit ToolTip(Visualization::toolTip); } } } From a362731040293fbc480b279997a780d88f0fefeb Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 13 Jul 2016 14:42:50 +0300 Subject: [PATCH 3/8] Added ToolTip for editing SplinePath. --HG-- branch : feature --- src/libs/vtools/visualization/path/vistoolsplinepath.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/vtools/visualization/path/vistoolsplinepath.cpp b/src/libs/vtools/visualization/path/vistoolsplinepath.cpp index 1842c8c1a..894305358 100644 --- a/src/libs/vtools/visualization/path/vistoolsplinepath.cpp +++ b/src/libs/vtools/visualization/path/vistoolsplinepath.cpp @@ -48,6 +48,7 @@ VisToolSplinePath::~VisToolSplinePath() { qDeleteAll(ctrlPoints); qDeleteAll(points); + emit ToolTip(""); } //--------------------------------------------------------------------------------------------------------------------- @@ -99,6 +100,11 @@ void VisToolSplinePath::RefreshGeometry() Visualization::toolTip = tr("Curved path: select three or more points, " "Enter - finish creation"); } + if (mode == Mode::Show) + { + Visualization::toolTip = tr("Use Shift for sticking angle!"); + emit ToolTip(Visualization::toolTip); + } } } From d96c885e0d884bb972d0a2b03b2be20e42d59586 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 13 Jul 2016 14:59:01 +0300 Subject: [PATCH 4/8] We don't need toolTip after we finished creation of CubicBezierPath. --HG-- branch : feature --- .../vtools/visualization/path/vistoolcubicbezierpath.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp b/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp index d394ec40b..708819cb3 100644 --- a/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp +++ b/src/libs/vtools/visualization/path/vistoolcubicbezierpath.cpp @@ -275,6 +275,11 @@ void VisToolCubicBezierPath::RefreshToolTip() { Visualization::toolTip = tr("Curved path: select more points for complete segment"); } + + if (mode == Mode::Show) + { + Visualization::toolTip = ""; + } emit ToolTip(Visualization::toolTip); } } From e080d845f31ca0cc105f076a8d4050e88bb3518f Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 13 Jul 2016 22:50:55 +0300 Subject: [PATCH 5/8] 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) From d248c4f18a25e6529432a36ff26751593119629c Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Mon, 25 Jul 2016 19:23:00 +0300 Subject: [PATCH 6/8] Added VAbstractMainWindow class. --HG-- branch : feature --- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/app/valentina/mainwindowsnogui.h | 3 +- src/libs/vwidgets/vabstractmainwindow.cpp | 36 +++++++++++++++ src/libs/vwidgets/vabstractmainwindow.h | 45 ++++++++++++++++++ src/libs/vwidgets/vwidgets.pri | 56 ++++++++++++----------- 5 files changed, 113 insertions(+), 29 deletions(-) create mode 100644 src/libs/vwidgets/vabstractmainwindow.cpp create mode 100644 src/libs/vwidgets/vabstractmainwindow.h diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index b3e6b9e72..326fbb387 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -57,7 +57,7 @@ //--------------------------------------------------------------------------------------------------------------------- MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) - : QMainWindow(parent), listDetails(QVector()), currentScene(nullptr), tempSceneLayout(nullptr), + : VAbstractMainWindow(parent), listDetails(QVector()), currentScene(nullptr), tempSceneLayout(nullptr), pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList()), shadows(QList()), scenes(QList()), details(QList >()), undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr), diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index dbff87c6c..25b446e37 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -37,13 +37,14 @@ #include "xml/vpattern.h" #include "dialogs/dialogsavelayout.h" #include "../vlayout/vlayoutgenerator.h" +#include "../vwidgets/vabstractmainwindow.h" class QGraphicsScene; class QPrinter; class PosterData; -class MainWindowsNoGUI : public QMainWindow +class MainWindowsNoGUI : public VAbstractMainWindow { Q_OBJECT public: diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp new file mode 100644 index 000000000..350c1e98d --- /dev/null +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -0,0 +1,36 @@ +/************************************************************************ + ** + ** @file + ** @author Valentina Zhuravska + ** @date 19 7, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vabstractmainwindow.h" + +VAbstractMainWindow::VAbstractMainWindow(QWidget *parent) : QMainWindow(parent) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractMainWindow::~VAbstractMainWindow() +{} diff --git a/src/libs/vwidgets/vabstractmainwindow.h b/src/libs/vwidgets/vabstractmainwindow.h new file mode 100644 index 000000000..c51aefb35 --- /dev/null +++ b/src/libs/vwidgets/vabstractmainwindow.h @@ -0,0 +1,45 @@ +/************************************************************************ + ** + ** @file + ** @author Valentina Zhuravska + ** @date 19 7, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VABSTRACTMAINWINDOW_H +#define VABSTRACTMAINWINDOW_H + +#include + +class VAbstractMainWindow : public QMainWindow +{ + Q_OBJECT +public: + explicit VAbstractMainWindow(QWidget *parent = nullptr); + virtual ~VAbstractMainWindow() Q_DECL_OVERRIDE; + +public slots: + virtual void ShowToolTip(const QString &toolTip)=0; +}; + +#endif // VABSTRACTMAINWINDOW_H diff --git a/src/libs/vwidgets/vwidgets.pri b/src/libs/vwidgets/vwidgets.pri index d80356e60..042607eb2 100644 --- a/src/libs/vwidgets/vwidgets.pri +++ b/src/libs/vwidgets/vwidgets.pri @@ -1,27 +1,29 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -SOURCES += \ - $$PWD/vmaingraphicsscene.cpp \ - $$PWD/vmaingraphicsview.cpp \ - $$PWD/vwidgetpopup.cpp \ - $$PWD/vcontrolpointspline.cpp \ - $$PWD/vgraphicssimpletextitem.cpp \ - $$PWD/vsimplepoint.cpp \ - $$PWD/vabstractsimple.cpp \ - $$PWD/vnobrushscalepathitem.cpp \ - $$PWD/vsimplecurve.cpp - -win32-msvc*:SOURCES += $$PWD/stable.cpp - -HEADERS += \ - $$PWD/stable.h \ - $$PWD/vmaingraphicsscene.h \ - $$PWD/vmaingraphicsview.h \ - $$PWD/vwidgetpopup.h \ - $$PWD/vcontrolpointspline.h \ - $$PWD/vgraphicssimpletextitem.h \ - $$PWD/vsimplepoint.h \ - $$PWD/vabstractsimple.h \ - $$PWD/vnobrushscalepathitem.h \ - $$PWD/vsimplecurve.h +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +SOURCES += \ + $$PWD/vmaingraphicsscene.cpp \ + $$PWD/vmaingraphicsview.cpp \ + $$PWD/vwidgetpopup.cpp \ + $$PWD/vcontrolpointspline.cpp \ + $$PWD/vgraphicssimpletextitem.cpp \ + $$PWD/vsimplepoint.cpp \ + $$PWD/vabstractsimple.cpp \ + $$PWD/vnobrushscalepathitem.cpp \ + $$PWD/vsimplecurve.cpp \ + $$PWD/vabstractmainwindow.cpp + +win32-msvc*:SOURCES += $$PWD/stable.cpp + +HEADERS += \ + $$PWD/stable.h \ + $$PWD/vmaingraphicsscene.h \ + $$PWD/vmaingraphicsview.h \ + $$PWD/vwidgetpopup.h \ + $$PWD/vcontrolpointspline.h \ + $$PWD/vgraphicssimpletextitem.h \ + $$PWD/vsimplepoint.h \ + $$PWD/vabstractsimple.h \ + $$PWD/vnobrushscalepathitem.h \ + $$PWD/vsimplecurve.h \ + $$PWD/vabstractmainwindow.h From f9c9cedfacaba4a6ac380260f876fa3c87062846 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Tue, 26 Jul 2016 13:45:17 +0300 Subject: [PATCH 7/8] We don't need DialogTool::ShowVisToolTip slot anymore. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 8 ++++---- src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp | 5 ++++- .../vtools/dialogs/tools/dialogcurveintersectaxis.cpp | 5 ++++- src/libs/vtools/dialogs/tools/dialogendline.cpp | 5 ++++- src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp | 5 ++++- src/libs/vtools/dialogs/tools/dialogrotation.cpp | 5 ++++- src/libs/vtools/dialogs/tools/dialogsplinepath.cpp | 6 +++++- src/libs/vtools/dialogs/tools/dialogtool.cpp | 6 ------ src/libs/vtools/dialogs/tools/dialogtool.h | 1 - 9 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index bb03c893c..89b6d2aaa 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -1920,9 +1920,9 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen if (spl != nullptr) { - MainWindow *window = qobject_cast(qApp->getMainWindow()); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); SCASSERT(window != nullptr); - connect(spl, &VToolSpline::ToolTip, window, &MainWindow::ShowToolTip); + connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip); } //Rewrite attribute formula. Need for situation when we have wrong formula. @@ -2109,9 +2109,9 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement if (spl != nullptr) { - MainWindow *window = qobject_cast(qApp->getMainWindow()); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); SCASSERT(window != nullptr); - connect(spl, &VToolSplinePath::ToolTip, window, &MainWindow::ShowToolTip); + connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip); } //Rewrite attribute formula. Need for situation when we have wrong formula. diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp index a53098c78..7bb13d604 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp @@ -29,6 +29,7 @@ #include "dialogcubicbezierpath.h" #include "ui_dialogcubicbezierpath.h" #include "../../visualization/path/vistoolcubicbezierpath.h" +#include "../vwidgets/vabstractmainwindow.h" #if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) # include "../vmisc/vmath.h" @@ -129,7 +130,9 @@ void DialogCubicBezierPath::ChosenObject(quint32 id, const SceneObject &type) if (path.CountPoints() == 1) { visPath->VisualMode(NULL_ID); - connect(visPath, &VisToolCubicBezierPath::ToolTip, this, &DialogTool::ShowVisToolTip); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(visPath, &VisToolCubicBezierPath::ToolTip, window, &VAbstractMainWindow::ShowToolTip); } else { diff --git a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp index 52ab4aa38..ba14e3565 100644 --- a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp @@ -36,6 +36,7 @@ #include "../../../vwidgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" #include "../support/dialogeditwrongformula.h" +#include "../vwidgets/vabstractmainwindow.h" #include @@ -218,7 +219,9 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type) { number++; line->VisualMode(id); - connect(line, &VisToolCurveIntersectAxis::ToolTip, this, &DialogTool::ShowVisToolTip); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip); } } break; diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index e1a921897..63941d0fb 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -36,6 +36,7 @@ #include "../../../vwidgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" #include "../support/dialogeditwrongformula.h" +#include "../vwidgets/vabstractmainwindow.h" #include //--------------------------------------------------------------------------------------------------------------------- @@ -167,7 +168,9 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type) if (SetObject(id, ui->comboBoxBasePoint, "")) { vis->VisualMode(id); - connect(vis, &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(vis, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); prepare = true; } } diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp index a61a6e3d0..932571b49 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp @@ -36,6 +36,7 @@ #include "../../../vwidgets/vmaingraphicsscene.h" #include "../../tools/vabstracttool.h" #include "../support/dialogeditwrongformula.h" +#include "../vwidgets/vabstractmainwindow.h" #include @@ -243,7 +244,9 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type) { number++; line->VisualMode(id); - connect(line, &VisToolLineIntersectAxis::ToolTip, this, &DialogTool::ShowVisToolTip); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip); } break; case (1): diff --git a/src/libs/vtools/dialogs/tools/dialogrotation.cpp b/src/libs/vtools/dialogs/tools/dialogrotation.cpp index 8af42964d..310b49eda 100644 --- a/src/libs/vtools/dialogs/tools/dialogrotation.cpp +++ b/src/libs/vtools/dialogs/tools/dialogrotation.cpp @@ -38,6 +38,7 @@ #include "../../visualization/line/vistoolrotation.h" #include "../support/dialogeditwrongformula.h" #include "../qmuparser/qmudef.h" +#include "../vwidgets/vabstractmainwindow.h" //--------------------------------------------------------------------------------------------------------------------- DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QWidget *parent) @@ -217,7 +218,9 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type) VisToolRotation *operation = qobject_cast(vis); SCASSERT(operation != nullptr); - connect(operation, &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); operation->SetOriginPointId(id); operation->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index 338f00ce6..918f649bf 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -33,6 +33,7 @@ #include "../../visualization/path/vistoolsplinepath.h" #include "../support/dialogeditwrongformula.h" #include "../qmuparser/qmuparsererror.h" +#include "../vwidgets/vabstractmainwindow.h" #include @@ -182,7 +183,10 @@ void DialogSplinePath::ChosenObject(quint32 id, const SceneObject &type) if (path.CountPoints() == 1) { visPath->VisualMode(NULL_ID); - connect(visPath, &VisToolSplinePath::ToolTip, this, &DialogTool::ShowVisToolTip); + VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); + SCASSERT(window != nullptr); + connect(visPath, &VisToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip); + connect(visPath, &VisToolSplinePath::PathChanged, this, &DialogSplinePath::PathUpdated); } else diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index af36c41af..01e24c86a 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -907,12 +907,6 @@ QString DialogTool::getPointName() const return pointName; } -//--------------------------------------------------------------------------------------------------------------------- -void DialogTool::ShowVisToolTip(const QString &toolTip) -{ - emit ToolTip(toolTip); -} - //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ShowDialog(bool click) { diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index ee47436bc..279479857 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -91,7 +91,6 @@ signals: */ void ToolTip(const QString &toolTip); public slots: - void ShowVisToolTip(const QString &toolTip); virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void SelectedObject(bool selected, quint32 object, quint32 tool); void NamePointChanged(); From 6081a5f9d734e4f8c6e04c0cfd38f5b0b5efa4e3 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Tue, 26 Jul 2016 16:16:09 +0300 Subject: [PATCH 8/8] Little fix. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index ad6ef18a1..6bfd1b954 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vpattern.h" -#include "mainwindow.h" +#include "../vwidgets/vabstractmainwindow.h" #include "../vtools/tools/vdatatool.h" #include "../vtools/tools/vtooldetail.h" #include "../vtools/tools/vtooluniondetails.h"