From 3dab49c23e9978cf77e65e2d9884863b3a0c4f4e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 20 Aug 2016 22:30:40 +0300 Subject: [PATCH] QVector::removeLast() supported since Qt 5.1. --HG-- branch : develop --- src/libs/vgeometry/varc.cpp | 4 +++ src/libs/vgeometry/vellipticalarc.cpp | 4 +++ .../ValentinaTest/tst_vabstractdetail.cpp | 36 +++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index 56b1f18e4..dd424fe66 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -241,7 +241,11 @@ QVector VArc::GetPoints() const QVector splPoints = spl.GetPoints(); if (not splPoints.isEmpty() && i != sectionAngle.size() - 1) { +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + splPoints.remove(splPoints.size() - 1); +#else splPoints.removeLast(); +#endif } points << splPoints; diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index ce2dab7cf..f501a3392 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -366,7 +366,11 @@ QVector VEllipticalArc::GetPoints() const if (not splPoints.isEmpty() && i != sectionAngle.size() - 1) { +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + splPoints.remove(splPoints.size() - 1); +#else splPoints.removeLast(); +#endif } points << splPoints; currentAngle += sectionAngle.at(i); diff --git a/src/test/ValentinaTest/tst_vabstractdetail.cpp b/src/test/ValentinaTest/tst_vabstractdetail.cpp index fa57bd567..c99ed0ba2 100644 --- a/src/test/ValentinaTest/tst_vabstractdetail.cpp +++ b/src/test/ValentinaTest/tst_vabstractdetail.cpp @@ -103,7 +103,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(10, 10); QTest::newRow("Correct closed a path (four unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Correct unclosed a path (four unique points)") << path << path; path.clear(); @@ -116,7 +120,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(0, 10); QTest::newRow("Correct closed a path (six unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Correct unclosed a path (six unique points)") << path << path; path.clear(); @@ -133,8 +141,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("One loop, closed a path (four unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("One loop, unclosed a path (four unique points)") << path << res; path.clear(); @@ -153,8 +166,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("Two loops, closed a path (six unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("Two loops, unclosed a path (six unique points)") << path << res; path.clear(); @@ -173,8 +191,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("One loop, the first loop, closed a path (six unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("One loop, the first loop, unclosed a path (six unique points)") << path << res; path.clear(); @@ -195,8 +218,13 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const res << QPointF(20, 10); QTest::newRow("One loop, the second loop, closed a path (six unique points)") << path << res; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); + res.remove(res.size() - 1); +#else path.removeLast(); res.removeLast(); +#endif QTest::newRow("One loop, the second loop, unclosed a path (six unique points)") << path << res; path.clear(); @@ -208,7 +236,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(20, 10); QTest::newRow("Correct closed a path, point on line (four unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Corect unclosed a path, point on line (four unique points)") << path << path; path.clear(); @@ -223,7 +255,11 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const path << QPointF(20, 10); QTest::newRow("Correct closed a path, point on line (six unique points)") << path << path; +#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) + path.remove(path.size() - 1); +#else path.removeLast(); +#endif QTest::newRow("Corect unclosed a path, point on line (six unique points)") << path << path; path.clear();