Fix support Visual Studio 2015.
This commit is contained in:
parent
daf7574f39
commit
70168ebe6c
|
@ -49,9 +49,9 @@ QT_WARNING_POP
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
constexpr qreal minStickyDistance = 3 / 25.4 * PrintDPI; // 3 mm
|
constexpr qreal minStickyDistance = MmToPixel(3.);
|
||||||
constexpr qreal maxStickyDistance = 10 / 25.4 * PrintDPI; // 10 mm
|
constexpr qreal maxStickyDistance = MmToPixel(10.);
|
||||||
constexpr qreal stickyShift = 1 / 25.4 * PrintDPI; // 1 mm
|
constexpr qreal stickyShift = MmToPixel(1.);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto CutEdge(const QLineF &edge) -> QVector<QPointF>
|
auto CutEdge(const QLineF &edge) -> QVector<QPointF>
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief tileStripeWidth the width of the info / glueing stripe in Px
|
* @brief tileStripeWidth the width of the info / glueing stripe in Px
|
||||||
*/
|
*/
|
||||||
static constexpr qreal tileStripeWidth = 10.0 / 25.4 * PrintDPI; // 1 cm to pixels
|
static constexpr qreal tileStripeWidth = CmToPixel(1.0);
|
||||||
|
|
||||||
auto WatermarkData() const -> const VWatermarkData &;
|
auto WatermarkData() const -> const VWatermarkData &;
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,6 @@
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||||
|
|
||||||
#if defined(__cpp_constexpr) && __cpp_constexpr-0 < 201304
|
|
||||||
const qreal VAbstractCurve::minLength = ToPixel(1, Unit::Mm);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
|
VAbstractCurve::VAbstractCurve(const GOType &type, const quint32 &idObject, const Draw &mode)
|
||||||
:VGObject(type, idObject, mode), d (new VAbstractCurveData())
|
:VGObject(type, idObject, mode), d (new VAbstractCurveData())
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -112,11 +112,7 @@ public:
|
||||||
|
|
||||||
void SetAliasSuffix(const QString &aliasSuffix) override;
|
void SetAliasSuffix(const QString &aliasSuffix) override;
|
||||||
|
|
||||||
#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
|
static constexpr qreal minLength = MmToPixel(1.);
|
||||||
static constexpr qreal minLength = ToPixel(1, Unit::Mm);
|
|
||||||
#else
|
|
||||||
static const qreal minLength;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void CreateName() =0;
|
virtual void CreateName() =0;
|
||||||
|
|
|
@ -214,7 +214,7 @@ auto JoinVectors(const QVector<QPointF> &v1, const QVector<QPointF> &v2) -> QVec
|
||||||
|
|
||||||
v = v1;
|
v = v1;
|
||||||
|
|
||||||
constexpr qreal accuracy = (0.0001/*mm*/ / 25.4) * PrintDPI;
|
constexpr qreal accuracy = MmToPixel(0.0001);
|
||||||
|
|
||||||
for (auto p : v2)
|
for (auto p : v2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ private:
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(VLayoutPassmark)
|
Q_DECLARE_METATYPE(VLayoutPassmark)
|
||||||
|
|
||||||
constexpr qreal accuracyPointOnLine = (0.1555/*mm*/ / 25.4) * PrintDPI;
|
constexpr qreal accuracyPointOnLine = MmToPixel(0.1555);
|
||||||
|
|
||||||
Q_REQUIRED_RESULT static inline bool VFuzzyComparePoints(const QPointF &p1, const QPointF &p2,
|
Q_REQUIRED_RESULT static inline bool VFuzzyComparePoints(const QPointF &p1, const QPointF &p2,
|
||||||
qreal accuracy = accuracyPointOnLine);
|
qreal accuracy = accuracyPointOnLine);
|
||||||
|
|
|
@ -54,7 +54,7 @@ const quint16 VAbstractPieceData::classVersion = 3;
|
||||||
const qreal maxL = 3.5;
|
const qreal maxL = 3.5;
|
||||||
|
|
||||||
const qreal VSAPoint::passmarkFactor = 0.5;
|
const qreal VSAPoint::passmarkFactor = 0.5;
|
||||||
const qreal VSAPoint::maxPassmarkLength = (10/*mm*/ / 25.4) * PrintDPI;
|
const qreal VSAPoint::maxPassmarkLength = MmToPixel(10.);
|
||||||
const qreal VSAPoint::minSAWidth = accuracyPointOnLine + accuracyPointOnLine*0.5;
|
const qreal VSAPoint::minSAWidth = accuracyPointOnLine + accuracyPointOnLine*0.5;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
|
@ -246,7 +246,7 @@ auto VAbstractPiece::RemoveDublicates(const QVector<T> &points, bool removeFirst
|
||||||
p.append(ConstFirst(points));
|
p.append(ConstFirst(points));
|
||||||
|
|
||||||
// Default accuracy is not enough
|
// Default accuracy is not enough
|
||||||
constexpr qreal accuracy = (0.5/*mm*/ / 25.4) * PrintDPI;
|
constexpr qreal accuracy = MmToPixel(0.5);
|
||||||
|
|
||||||
for (int i = 0; i < points.size(); ++i)
|
for (int i = 0; i < points.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,7 +120,7 @@ QPixmap WatermarkImageFromCache(const VWatermarkData &watermarkData, const QStri
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPoster::VPoster(const QPrinter *printer)
|
VPoster::VPoster(const QPrinter *printer)
|
||||||
:printer(printer), allowance(static_cast<quint32>(qRound(10./25.4*PrintDPI)))//1 cm
|
:printer(printer), allowance(static_cast<quint32>(qRound(CmToPixel(1.))))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,17 +375,21 @@ const int userMaterialPlaceholdersQuantity = 20;
|
||||||
QPixmap QPixmapFromCache(const QString &pixmapPath);
|
QPixmap QPixmapFromCache(const QString &pixmapPath);
|
||||||
void SetItemOverrideCursor(QGraphicsItem *item, const QString & pixmapPath, int hotX = -1, int hotY = -1);
|
void SetItemOverrideCursor(QGraphicsItem *item, const QString & pixmapPath, int hotX = -1, int hotY = -1);
|
||||||
|
|
||||||
|
template<typename T> Q_DECL_CONSTEXPR inline auto MmToPixel(T val) -> T { return (val / 25.4) * PrintDPI; }
|
||||||
|
template<typename T> Q_DECL_CONSTEXPR inline auto CmToPixel(T val) -> T { return ((val * 10.0) / 25.4) * PrintDPI; }
|
||||||
|
template<typename T> Q_DECL_CONSTEXPR inline auto InchToPixel(T val) -> T { return val * PrintDPI; }
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline double ToPixel(double val, const Unit &unit)
|
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) -> double
|
||||||
{
|
{
|
||||||
switch (unit)
|
switch (unit)
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
return (val / 25.4) * PrintDPI;
|
return MmToPixel(val);
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
return ((val * 10.0) / 25.4) * PrintDPI;
|
return CmToPixel(val);
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
return val * PrintDPI;
|
return InchToPixel(val);
|
||||||
case Unit::Px:
|
case Unit::Px:
|
||||||
return val;
|
return val;
|
||||||
default:
|
default:
|
||||||
|
@ -394,17 +398,21 @@ Q_DECL_RELAXED_CONSTEXPR inline double ToPixel(double val, const Unit &unit)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T> Q_DECL_CONSTEXPR inline auto PixelToMm(T pix) -> T { return (pix / PrintDPI) * 25.4; }
|
||||||
|
template<typename T> Q_DECL_CONSTEXPR inline auto PixelToCm(T pix) -> T { return ((pix / PrintDPI) * 25.4) / 10.0; }
|
||||||
|
template<typename T> Q_DECL_CONSTEXPR inline auto PixelToInch(T pix) -> T { return pix / PrintDPI; }
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline double FromPixel(double pix, const Unit &unit)
|
Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel(double pix, const Unit &unit) -> double
|
||||||
{
|
{
|
||||||
switch (unit)
|
switch (unit)
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
return (pix / PrintDPI) * 25.4;
|
return PixelToMm(pix);
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
return ((pix / PrintDPI) * 25.4) / 10.0;
|
return PixelToCm(pix);
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
return pix / PrintDPI;
|
return PixelToInch(pix);
|
||||||
case Unit::Px:
|
case Unit::Px:
|
||||||
return pix;
|
return pix;
|
||||||
default:
|
default:
|
||||||
|
@ -414,7 +422,7 @@ Q_DECL_RELAXED_CONSTEXPR inline double FromPixel(double pix, const Unit &unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline qreal UnitConvertor(qreal value, const Unit &from, const Unit &to)
|
Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(qreal value, const Unit &from, const Unit &to) -> qreal
|
||||||
{
|
{
|
||||||
switch (from)
|
switch (from)
|
||||||
{
|
{
|
||||||
|
@ -489,14 +497,15 @@ Q_DECL_RELAXED_CONSTEXPR inline qreal UnitConvertor(qreal value, const Unit &fro
|
||||||
* @brief UnitConvertor Converts the values of the given margin from given unit to the new unit.
|
* @brief UnitConvertor Converts the values of the given margin from given unit to the new unit.
|
||||||
* returns a new instand of QMarginsF.
|
* returns a new instand of QMarginsF.
|
||||||
*/
|
*/
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline QMarginsF UnitConvertor(const QMarginsF &margins, const Unit &from, const Unit &to)
|
Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(const QMarginsF &margins, const Unit &from,
|
||||||
|
const Unit &to) -> QMarginsF
|
||||||
{
|
{
|
||||||
const qreal left = UnitConvertor(margins.left(), from, to);
|
const qreal left = UnitConvertor(margins.left(), from, to);
|
||||||
const qreal top = UnitConvertor(margins.top(), from, to);
|
const qreal top = UnitConvertor(margins.top(), from, to);
|
||||||
const qreal right = UnitConvertor(margins.right(), from, to);
|
const qreal right = UnitConvertor(margins.right(), from, to);
|
||||||
const qreal bottom = UnitConvertor(margins.bottom(), from, to);
|
const qreal bottom = UnitConvertor(margins.bottom(), from, to);
|
||||||
|
|
||||||
return QMarginsF(left, top, right, bottom);
|
return {left, top, right, bottom};
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitLanguages(QComboBox *combobox);
|
void InitLanguages(QComboBox *combobox);
|
||||||
|
|
|
@ -141,7 +141,7 @@ bool FixNotchPoint(const QVector<QPointF> &seamAllowance, const QPointF ¬chBa
|
||||||
|
|
||||||
return fixed;
|
return fixed;
|
||||||
}
|
}
|
||||||
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
|
const qreal passmarkGap = MmToPixel(1.5);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> CreateOnePassmarkLines(const QLineF &line)
|
QVector<QLineF> CreateOnePassmarkLines(const QLineF &line)
|
||||||
|
|
|
@ -312,7 +312,7 @@ void AbstractTest::Comparison(const QVector<QPointF> &ekv, const QVector<QPointF
|
||||||
{
|
{
|
||||||
// Begin comparison
|
// Begin comparison
|
||||||
QCOMPARE(ekv.size(), ekvOrig.size());// First check if sizes equal
|
QCOMPARE(ekv.size(), ekvOrig.size());// First check if sizes equal
|
||||||
const qreal testAccuracy = (1.0/*mm*/ / 25.4) * PrintDPI;
|
const qreal testAccuracy = MmToPixel(1.);
|
||||||
|
|
||||||
for (int i=0; i < ekv.size(); i++)
|
for (int i=0; i < ekv.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,7 @@ void VMainGraphicsScene::InitOrigins()
|
||||||
{
|
{
|
||||||
origins.clear();
|
origins.clear();
|
||||||
|
|
||||||
QPen originsPen(Qt::green, (1.2 / 3.0) /*mm*/ / 25.4 * PrintDPI, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
QPen originsPen(Qt::green, MmToPixel(1.2 / 3.0), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
QBrush axisTextBrush(Qt::green);
|
QBrush axisTextBrush(Qt::green);
|
||||||
const qreal arrowAngle = 35.0;
|
const qreal arrowAngle = 35.0;
|
||||||
const qreal arrowLength = 12.0;
|
const qreal arrowLength = 12.0;
|
||||||
|
|
|
@ -45,12 +45,12 @@
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
#include "vtextgraphicsitem.h"
|
#include "vtextgraphicsitem.h"
|
||||||
|
|
||||||
const qreal resizeSquare = (3./*mm*/ / 25.4) * PrintDPI;
|
const qreal resizeSquare = MmToPixel(3.);
|
||||||
const qreal rotateCircle = (2./*mm*/ / 25.4) * PrintDPI;
|
const qreal rotateCircle = MmToPixel(2.);
|
||||||
#define ROTATE_RECT 60
|
#define ROTATE_RECT 60
|
||||||
#define ROTATE_ARC 50
|
#define ROTATE_ARC 50
|
||||||
const qreal minW = (4./*mm*/ / 25.4) * PrintDPI + resizeSquare;
|
const qreal minW = MmToPixel(4.) + resizeSquare;
|
||||||
const qreal minH = (4./*mm*/ / 25.4) * PrintDPI + resizeSquare;
|
const qreal minH = MmToPixel(4.) + resizeSquare;
|
||||||
#define ACTIVE_Z 10
|
#define ACTIVE_Z 10
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
Loading…
Reference in New Issue
Block a user