From a5191ce7636a6320567a26c86c5004d450f0bc8c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 20 May 2021 11:48:47 +0300 Subject: [PATCH 1/6] Control length of a passmark for builtin seam allowance with global setting. #124 This case was not covered. --- src/libs/vpatterndb/vpassmark.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/libs/vpatterndb/vpassmark.cpp b/src/libs/vpatterndb/vpassmark.cpp index f7135acde..84d4ab4e0 100644 --- a/src/libs/vpatterndb/vpassmark.cpp +++ b/src/libs/vpatterndb/vpassmark.cpp @@ -831,12 +831,20 @@ QVector VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const } else { - const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2' with built in " - "seam allowance. User must manually provide length.") - .arg(m_data.nodeName, m_data.pieceName); - VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; - return QVector(); + if (m_data.globalPassmarkLength > accuracyPointOnLine) + { + length = m_data.globalPassmarkLength; + } + else + { + const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2' with built " + "in seam allowance. User must manually provide length.") + .arg(m_data.nodeName, m_data.pieceName); + VAbstractApplication::VApp()->IsPedantic() + ? throw VExceptionInvalidNotch(errorMsg) + : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; + return {}; + } } } From 00b436e21d6ed4d0f613a998e30a2a8703b1a194 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 25 May 2021 17:28:45 +0300 Subject: [PATCH 2/6] "Select New for creation measurement file" should be "Select New to create a measurement file". Closes #128 --- src/app/tape/tmainwindow.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui index b31ae4f4a..f608b2a3b 100644 --- a/src/app/tape/tmainwindow.ui +++ b/src/app/tape/tmainwindow.ui @@ -34,7 +34,7 @@ - <html><head/><body><p><span style=" font-size:18pt;">Select New for creation measurement file.</span></p></body></html> + <html><head/><body><p><span style=" font-size:18pt;">Select New to create a measurement file.</span></p></body></html> Qt::AlignCenter @@ -968,7 +968,7 @@ 0 0 1188 - 21 + 22 From 18c804c9623d6526747e7f3a5581d9ef930a8d91 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 26 May 2021 10:40:21 +0300 Subject: [PATCH 3/6] Fix closing a pattern file. Because we did not properly cleared VAbstractPattern class state Valentina thought that after closing the pattern file we still have unsaved changes. (cherry picked from commit a907ab03cee8931b1a1a649c296a615a8c46efc7) --- src/libs/ifc/xml/vabstractpattern.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 68688fffb..21ddcac5b 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -604,6 +604,7 @@ void VAbstractPattern::Clear() m_watermarkPath.clear(); m_companyName.clear(); m_units = Unit::LAST_UNIT_DO_NOT_USE; + modified = false; } //--------------------------------------------------------------------------------------------------------------------- From 3ae13febd3b1f718fbe9fd1093afee6c76f8f9ef Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 31 May 2021 12:07:28 +0300 Subject: [PATCH 4/6] Incorrect behavior of empty arc and elliptical arc. Closes #129 --- ChangeLog.txt | 3 ++ src/libs/vgeometry/varc.cpp | 5 +++ src/libs/vgeometry/vellipticalarc.cpp | 36 +++++++++++++++++-- src/libs/vgeometry/vellipticalarc.h | 3 ++ src/test/ValentinaTest/tst_varc.cpp | 9 +++++ src/test/ValentinaTest/tst_varc.h | 1 + src/test/ValentinaTest/tst_vellipticalarc.cpp | 26 ++++++++++++++ src/test/ValentinaTest/tst_vellipticalarc.h | 2 ++ 8 files changed, 83 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 544c9fd27..9a3b40447 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +# Valentina 0.7.48 (unreleased) +- [smart-pattern/valentina#129] Incorrect behavior of empty arc and elliptical arc. + # Version 0.7.47 May 13, 2021 - [smart-pattern/valentina#118] Incorrect seam allowance. - [smart-pattern/valentina#119] Improve tool Point of intersection curves. diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index 545b2f98f..9ec997da1 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -263,6 +263,11 @@ QPointF VArc::GetP2 () const */ QVector VArc::GetPoints() const { + if (qFuzzyIsNull(GetRadius())) + { + return {GetCenter().toQPointF()}; + } + QVector points; QVector sectionAngle; diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index a616055cd..42deedbd7 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -493,12 +493,23 @@ qreal VEllipticalArc::MaxLength() const //--------------------------------------------------------------------------------------------------------------------- QPointF VEllipticalArc::GetP(qreal angle) const { + if (qFuzzyIsNull(GetRadius1()) && qFuzzyIsNull(GetRadius2())) + { + return GetCenter().toQPointF(); + } + QLineF line(0, 0, 100, 0); line.setAngle(angle); - const qreal a = line.p2().x() / GetRadius1(); - const qreal b = line.p2().y() / GetRadius2(); + const qreal a = not qFuzzyIsNull(GetRadius1()) ? line.p2().x() / GetRadius1() : 0; + const qreal b = not qFuzzyIsNull(GetRadius2()) ? line.p2().y() / GetRadius2() : 0; const qreal k = qSqrt(a*a + b*b); + + if (qFuzzyIsNull(k)) + { + return GetCenter().toQPointF(); + } + QPointF p(line.p2().x() / k, line.p2().y() / k); QLineF line2(QPointF(), p); @@ -565,6 +576,13 @@ void VEllipticalArc::SetFormulaRadius1(const QString &formula, qreal value) d->radius1 = value; } +//--------------------------------------------------------------------------------------------------------------------- +void VEllipticalArc::SetRadius1(qreal value) +{ + d->formulaRadius1 = QString::number(value); + d->radius1 = value; +} + //--------------------------------------------------------------------------------------------------------------------- void VEllipticalArc::SetFormulaRadius2(const QString &formula, qreal value) { @@ -572,6 +590,13 @@ void VEllipticalArc::SetFormulaRadius2(const QString &formula, qreal value) d->radius2 = value; } +//--------------------------------------------------------------------------------------------------------------------- +void VEllipticalArc::SetRadius2(qreal value) +{ + d->formulaRadius2 = QString::number(value); + d->radius2 = value; +} + //--------------------------------------------------------------------------------------------------------------------- void VEllipticalArc::SetFormulaRotationAngle(const QString &formula, qreal value) { @@ -579,6 +604,13 @@ void VEllipticalArc::SetFormulaRotationAngle(const QString &formula, qreal value d->rotationAngle = value; } +//--------------------------------------------------------------------------------------------------------------------- +void VEllipticalArc::SetRotationAngle(qreal value) +{ + d->formulaRotationAngle = QString::number(value); + d->rotationAngle = value; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief GetRadius1 return elliptical arc major radius. diff --git a/src/libs/vgeometry/vellipticalarc.h b/src/libs/vgeometry/vellipticalarc.h index 481afcfaf..088a1c261 100644 --- a/src/libs/vgeometry/vellipticalarc.h +++ b/src/libs/vgeometry/vellipticalarc.h @@ -75,14 +75,17 @@ public: QString GetFormulaRotationAngle () const; void SetFormulaRotationAngle (const QString &formula, qreal value); + void SetRotationAngle(qreal value); qreal GetRotationAngle() const; QString GetFormulaRadius1 () const; void SetFormulaRadius1 (const QString &formula, qreal value); + void SetRadius1 (qreal value); qreal GetRadius1 () const; QString GetFormulaRadius2 () const; void SetFormulaRadius2 (const QString &formula, qreal value); + void SetRadius2 (qreal value); qreal GetRadius2 () const; virtual qreal GetLength () const override; diff --git a/src/test/ValentinaTest/tst_varc.cpp b/src/test/ValentinaTest/tst_varc.cpp index 0ef8b1a7e..cf370f620 100644 --- a/src/test/ValentinaTest/tst_varc.cpp +++ b/src/test/ValentinaTest/tst_varc.cpp @@ -456,3 +456,12 @@ void TST_VArc::TestCurveIntersectAxis() Comparison(intersectionPoint, crosPoint, accuracyPointOnLine); } + +//--------------------------------------------------------------------------------------------------------------------- +void TST_VArc::EmptyArc() +{ + VArc empty; + + Comparison(empty.GetPoints(), {QPointF()}); + QCOMPARE(empty.GetLength(), 0); +} diff --git a/src/test/ValentinaTest/tst_varc.h b/src/test/ValentinaTest/tst_varc.h index f83655bf6..0d7854bab 100644 --- a/src/test/ValentinaTest/tst_varc.h +++ b/src/test/ValentinaTest/tst_varc.h @@ -50,6 +50,7 @@ private slots: void TestCutArc(); void TestCurveIntersectAxis_data(); void TestCurveIntersectAxis(); + void EmptyArc(); }; #endif // TST_VARC_H diff --git a/src/test/ValentinaTest/tst_vellipticalarc.cpp b/src/test/ValentinaTest/tst_vellipticalarc.cpp index 938b00033..4e967a811 100644 --- a/src/test/ValentinaTest/tst_vellipticalarc.cpp +++ b/src/test/ValentinaTest/tst_vellipticalarc.cpp @@ -577,3 +577,29 @@ void TST_VEllipticalArc::TestFlip() QCOMPARE(elArc.GetRadius1(), res.GetRadius1()); QCOMPARE(elArc.GetRadius2(), res.GetRadius2()); } + +//--------------------------------------------------------------------------------------------------------------------- +void TST_VEllipticalArc::EmptyArc_data() +{ + QTest::addColumn("radius1"); + QTest::addColumn("radius2"); + QTest::addColumn("length"); + + QTest::newRow("Empty elArc") << 0. << 0. << 0.; + QTest::newRow("Radius1 correct") << 50. << 0. << 50.*4; + QTest::newRow("Radius2 correct") << 0. << 30. << 30.*4; +} + +//--------------------------------------------------------------------------------------------------------------------- +void TST_VEllipticalArc::EmptyArc() +{ + QFETCH(qreal, radius1); + QFETCH(qreal, radius2); + QFETCH(qreal, length); + + VEllipticalArc empty; + empty.SetRadius1(radius1); + empty.SetRadius2(radius2); + + QCOMPARE(empty.GetLength(), length); +} diff --git a/src/test/ValentinaTest/tst_vellipticalarc.h b/src/test/ValentinaTest/tst_vellipticalarc.h index 99f4486dc..74730a43b 100644 --- a/src/test/ValentinaTest/tst_vellipticalarc.h +++ b/src/test/ValentinaTest/tst_vellipticalarc.h @@ -55,6 +55,8 @@ private slots: void TestRotation(); void TestFlip_data(); void TestFlip(); + void EmptyArc_data(); + void EmptyArc(); private: Q_DISABLE_COPY(TST_VEllipticalArc) From daf42ccb678d7fb6e6a9737fe0f4a4a3a9096d09 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 31 May 2021 12:23:59 +0300 Subject: [PATCH 5/6] Fix build. --- src/test/ValentinaTest/tst_varc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ValentinaTest/tst_varc.cpp b/src/test/ValentinaTest/tst_varc.cpp index cf370f620..58d4e8730 100644 --- a/src/test/ValentinaTest/tst_varc.cpp +++ b/src/test/ValentinaTest/tst_varc.cpp @@ -463,5 +463,5 @@ void TST_VArc::EmptyArc() VArc empty; Comparison(empty.GetPoints(), {QPointF()}); - QCOMPARE(empty.GetLength(), 0); + QCOMPARE(empty.GetLength(), 0.); } From 40619c22efa626615d4b95b2de4a392cbeb93c46 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 4 Jun 2021 08:49:09 +0300 Subject: [PATCH 6/6] Hide warnings related to QMacCGContext. --- src/app/tape/mapplication.cpp | 8 ++++++++ src/app/valentina/core/vapplication.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 007e83305..95807c57c 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -117,6 +117,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con } # endif +# if QT_VERSION < QT_VERSION_CHECK(5, 9, 0) // Hide Qt bug 'Assertion when reading an icns file' // https://bugreports.qt.io/browse/QTBUG-45537 // Remove after Qt fix will be released @@ -124,6 +125,13 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con { type = QtDebugMsg; } +# endif + + // Hide anything that starts with QMacCGContext + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::"))) + { + type = QtDebugMsg; + } // See issue #568 if (msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 36e7c1621..648050fd9 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -114,6 +114,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con } # endif +# if QT_VERSION < QT_VERSION_CHECK(5, 9, 0) // Hide Qt bug 'Assertion when reading an icns file' // https://bugreports.qt.io/browse/QTBUG-45537 // Remove after Qt fix will be released @@ -121,6 +122,13 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con { type = QtDebugMsg; } +# endif + + // Hide anything that starts with QMacCGContext + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::"))) + { + type = QtDebugMsg; + } // See issue #568 if (msg.contains(QStringLiteral("Error receiving trust for a CA certificate")))