diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp index 82cf221a5..3cc447736 100644 --- a/src/libs/vlayout/vlayoutpaper.cpp +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -49,6 +49,7 @@ #include "vlayoutpaper_p.h" #include "vposition.h" #include "../ifc/exception/vexceptionterminatedposition.h" +#include "../vmisc/compatibility.h" //--------------------------------------------------------------------------------------------------------------------- VLayoutPaper::VLayoutPaper() @@ -411,7 +412,7 @@ QVector VLayoutPaper::GetDetails() const //--------------------------------------------------------------------------------------------------------------------- void VLayoutPaper::SetDetails(const QList &details) { - d->details = details.toVector(); + d->details = ConvertToVector(details); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 0a200d00e..085714dfc 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -519,7 +519,7 @@ QVector VLayoutPiece::Map(QVector points) const { SwapItemsAt(list, k, s-(1+k)); } - points = list.toVector(); + points = ConvertToVector(list); } return points; } diff --git a/src/libs/vmisc/compatibility.h b/src/libs/vmisc/compatibility.h index 09a3d6cd2..e350f6e0d 100644 --- a/src/libs/vmisc/compatibility.h +++ b/src/libs/vmisc/compatibility.h @@ -102,6 +102,17 @@ inline QSet ConvertToSet(const C &container) #endif } +//--------------------------------------------------------------------------------------------------------------------- +template class C> +inline QVector ConvertToVector(const C &container) +{ +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QVector(container.begin(), container.end()); +#else + return container.toVector(); +#endif +} + //--------------------------------------------------------------------------------------------------------------------- template inline void SwapItemsAt(T &container, int i, int j) diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp index f24daa1a8..b07d71c68 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp @@ -52,6 +52,7 @@ #include "../vgeometry/vpointf.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vcommonsettings.h" +#include "../vmisc/compatibility.h" #include "../vpatterndb/vcontainer.h" #include "../vwidgets/vabstractmainwindow.h" #include "../vwidgets/vmaingraphicsscene.h" @@ -143,7 +144,7 @@ void DialogFlippingByAxis::SetSuffix(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QVector DialogFlippingByAxis::GetObjects() const { - return objects.toVector(); + return ConvertToVector(objects); } //--------------------------------------------------------------------------------------------------------------------- @@ -164,7 +165,7 @@ void DialogFlippingByAxis::ShowDialog(bool click) VisToolFlippingByAxis *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->VisualMode(); scene->ToggleArcSelection(false); @@ -290,7 +291,7 @@ void DialogFlippingByAxis::SaveData() VisToolFlippingByAxis *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->SetOriginPointId(GetOriginPointId()); operation->SetAxisType(GetAxisType()); operation->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp index 19aa5cfe5..f5b76a5e6 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp @@ -52,6 +52,7 @@ #include "../vgeometry/vpointf.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vcommonsettings.h" +#include "../vmisc/compatibility.h" #include "../vpatterndb/vcontainer.h" #include "../vwidgets/vabstractmainwindow.h" #include "../vwidgets/vmaingraphicsscene.h" @@ -138,7 +139,7 @@ void DialogFlippingByLine::SetSuffix(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QVector DialogFlippingByLine::GetObjects() const { - return objects.toVector(); + return ConvertToVector(objects); } //--------------------------------------------------------------------------------------------------------------------- @@ -159,7 +160,7 @@ void DialogFlippingByLine::ShowDialog(bool click) VisToolFlippingByLine *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->VisualMode(); scene->ToggleArcSelection(false); @@ -314,7 +315,7 @@ void DialogFlippingByLine::SaveData() VisToolFlippingByLine *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->SetFirstLinePointId(GetFirstLinePointId()); operation->SetSecondLinePointId(GetSecondLinePointId()); operation->RefreshGeometry(); diff --git a/src/libs/vtools/dialogs/tools/dialogmove.cpp b/src/libs/vtools/dialogs/tools/dialogmove.cpp index d44d63ed7..f928138e0 100644 --- a/src/libs/vtools/dialogs/tools/dialogmove.cpp +++ b/src/libs/vtools/dialogs/tools/dialogmove.cpp @@ -56,6 +56,7 @@ #include "../vgeometry/vpointf.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vcommonsettings.h" +#include "../vmisc/compatibility.h" #include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vtranslatevars.h" #include "../vwidgets/vabstractmainwindow.h" @@ -253,7 +254,7 @@ void DialogMove::SetRotationOrigPointId(const quint32 &value) //--------------------------------------------------------------------------------------------------------------------- QVector DialogMove::GetObjects() const { - return objects.toVector(); + return ConvertToVector(objects); } //--------------------------------------------------------------------------------------------------------------------- @@ -275,7 +276,7 @@ void DialogMove::ShowDialog(bool click) VisToolMove *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->VisualMode(); VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()); @@ -497,7 +498,7 @@ void DialogMove::SaveData() VisToolMove *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->SetAngle(formulaAngle); operation->SetLength(formulaLength); operation->SetRotationAngle(formulaRotationAngle); diff --git a/src/libs/vtools/dialogs/tools/dialogrotation.cpp b/src/libs/vtools/dialogs/tools/dialogrotation.cpp index a1f73e0a9..921d2615f 100644 --- a/src/libs/vtools/dialogs/tools/dialogrotation.cpp +++ b/src/libs/vtools/dialogs/tools/dialogrotation.cpp @@ -56,6 +56,7 @@ #include "../vgeometry/vpointf.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vcommonsettings.h" +#include "../vmisc/compatibility.h" #include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vtranslatevars.h" #include "../vwidgets/vabstractmainwindow.h" @@ -166,7 +167,7 @@ void DialogRotation::SetSuffix(const QString &value) //--------------------------------------------------------------------------------------------------------------------- QVector DialogRotation::GetObjects() const { - return objects.toVector(); + return ConvertToVector(objects); } //--------------------------------------------------------------------------------------------------------------------- @@ -187,7 +188,7 @@ void DialogRotation::ShowDialog(bool click) VisToolRotation *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->VisualMode(); scene->ToggleArcSelection(false); @@ -261,7 +262,7 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type) // It's not really logical for a user that a center of rotation no need to select. // To fix this issue we just silently remove it from the list. objects.removeOne(id); - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); } else { @@ -380,7 +381,7 @@ void DialogRotation::SaveData() VisToolRotation *operation = qobject_cast(vis); SCASSERT(operation != nullptr) - operation->SetObjects(objects.toVector()); + operation->SetObjects(ConvertToVector(objects)); operation->SetOriginPointId(GetOrigPointId()); operation->SetAngle(formulaAngle); operation->RefreshGeometry();