Fix compatibility with Qt 5.15.

This commit is contained in:
Roman Telezhynskyi 2024-04-13 16:59:50 +03:00
parent 7a89aa93e9
commit cff3e08c9e

View File

@ -27,8 +27,6 @@
*************************************************************************/
#include "vppiece.h"
#include <QtMath>
#include "../vgeometry/vlayoutplacelabel.h"
#include "../vlayout/vlayoutpiecepath.h"
#include "../vlayout/vtextmanager.h"
@ -42,6 +40,9 @@
#include <QPainter>
#include <QPainterPath>
#include <QtConcurrent>
#include <QtMath>
#include <functional>
#include <limits>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
@ -439,9 +440,7 @@ auto VPPiece::PrepareStickyPath(const QVector<QPointF> &path) -> QVector<QPointF
//---------------------------------------------------------------------------------------------------------------------
auto VPPiece::ClosestDistance(const QVector<QPointF> &path1, const QVector<QPointF> &path2) -> QLineF
{
return QtConcurrent::blockingMappedReduced<QLineF>(
path1,
[path2](const QPointF &p1)
std::function<QLineF(const QPointF &)> const DistanceFunc = [path2](const QPointF &p1)
{
qreal minLocalDistance = std::numeric_limits<qreal>::max();
QLineF localClosestDistance;
@ -458,8 +457,9 @@ auto VPPiece::ClosestDistance(const QVector<QPointF> &path1, const QVector<QPoin
}
return localClosestDistance;
},
[](QLineF &result, const QLineF &next)
};
std::function<void(QLineF &, const QLineF &)> const ReduceFunc = [](QLineF &result, const QLineF &next)
{
qreal const dist1 = result.length();
qreal const dist2 = next.length();
@ -467,7 +467,9 @@ auto VPPiece::ClosestDistance(const QVector<QPointF> &path1, const QVector<QPoin
{
result = next;
}
});
};
return QtConcurrent::blockingMappedReduced<QLineF>(path1, DistanceFunc, ReduceFunc);
}
//---------------------------------------------------------------------------------------------------------------------