Fix build issues.

This commit is contained in:
Roman Telezhynskyi 2023-05-11 16:23:57 +03:00
parent 113b685c9c
commit 2aeaebdebc
13 changed files with 60 additions and 27 deletions

View File

@ -31,6 +31,7 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" # include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include <QCoreApplication> #include <QCoreApplication>

View File

@ -30,6 +30,7 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" # include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
// See https://stackoverflow.com/a/46719572/3045403 // See https://stackoverflow.com/a/46719572/3045403

View File

@ -37,9 +37,11 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" # include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"

View File

@ -37,12 +37,15 @@
#include "../vpatterndb/floatItemData/floatitemdef.h" #include "../vpatterndb/floatItemData/floatitemdef.h"
#include "../vwidgets/vpiecegrainline.h" #include "../vwidgets/vpiecegrainline.h"
#include "compatibility.h" #include "compatibility.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" # include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "vlayoutpiecepath.h" #include "vlayoutpiecepath.h"
#include "../vgeometry/vgeometrydef.h" #include "../vgeometry/vgeometrydef.h"
#include "vtextmanager.h" #include "vtextmanager.h"

View File

@ -37,9 +37,11 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" # include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "vlayoutpoint.h" #include "vlayoutpoint.h"

View File

@ -40,9 +40,11 @@
#include "../ifc/xml/vabstractpattern.h" #include "../ifc/xml/vabstractpattern.h"
#include "../vpatterndb/floatItemData/vpiecelabeldata.h" #include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
# include "../vmisc/vdatastreamenum.h" # include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/calculator.h" #include "../vpatterndb/calculator.h"
#include "../vpatterndb/variables/vmeasurement.h" #include "../vpatterndb/variables/vmeasurement.h"

View File

@ -28,12 +28,13 @@
#ifndef COMPATIBILITY_H #ifndef COMPATIBILITY_H
#define COMPATIBILITY_H #define COMPATIBILITY_H
#include <QtGlobal>
#include <QStringList>
#include <QSet>
#include <QVector>
#include <QFontMetrics> #include <QFontMetrics>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QLineF>
#include <QSet>
#include <QStringList>
#include <QVector>
#include <QtGlobal>
#include "defglobal.h" #include "defglobal.h"
@ -360,4 +361,14 @@ inline auto QLibraryPath(T loc) -> QString
#endif #endif
} }
//---------------------------------------------------------------------------------------------------------------------
inline auto LineCenter(const QLineF &line) -> QPointF
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
return line.center();
#else
return {0.5 * line.p1().x() + 0.5 * line.p2().x(), 0.5 * line.p1().y() + 0.5 * line.p2().y()};
#endif
}
#endif // COMPATIBILITY_H #endif // COMPATIBILITY_H

View File

@ -32,6 +32,7 @@
#include "../vgeometry/vabstractcurve.h" #include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/varc.h" #include "../vgeometry/varc.h"
#include "../vlayout/vrawsapoint.h" #include "../vlayout/vrawsapoint.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/testpath.h" // do not remove #include "../vmisc/testpath.h" // do not remove
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
#include "../vpatterndb/testpassmark.h" // do not remove #include "../vpatterndb/testpassmark.h" // do not remove
@ -363,7 +364,7 @@ auto CreateTMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF &l
p2 = tmpLine.p2(); p2 = tmpLine.p2();
} }
return {line, {QLineF(p1, p2).center(), p2}, {p2, p1}}; return {line, {LineCenter({p1, p2}), p2}, {p2, p1}};
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@
#define DIALOGSEAMALLOWANCE_H #define DIALOGSEAMALLOWANCE_H
#include "../dialogtool.h" #include "../dialogtool.h"
#include "../vgeometry/vplacelabelitem.h"
#include "../vpatterndb/vpiece.h" #include "../vpatterndb/vpiece.h"
#include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/vpiecepath.h"
@ -46,7 +47,6 @@ namespace Ui
class VisPieceSpecialPoints; class VisPieceSpecialPoints;
class FancyTabBar; class FancyTabBar;
class VPlaceLabelItem;
class VUndoCommand; class VUndoCommand;
class DialogSeamAllowance : public DialogTool class DialogSeamAllowance : public DialogTool

View File

@ -371,10 +371,11 @@ void VNodePoint::InitPassmarkMenu(QMenu *menu, vidtype pieceId, QHash<int, QActi
SCASSERT(menu != nullptr) SCASSERT(menu != nullptr)
const VPiece detail = VAbstractTool::data.GetPiece(pieceId); const VPiece detail = VAbstractTool::data.GetPiece(pieceId);
const int nodeIndex = detail.GetPath().indexOfNode(m_id); const VPiecePath &path = detail.GetPath();
const int nodeIndex = path.indexOfNode(m_id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
const VPieceNode &node = detail.GetPath().at(nodeIndex); const VPieceNode &node = path.at(nodeIndex);
QAction *actionPassmark = menu->addAction(tr("Passmark")); QAction *actionPassmark = menu->addAction(tr("Passmark"));
actionPassmark->setCheckable(true); actionPassmark->setCheckable(true);
@ -395,11 +396,11 @@ void VNodePoint::InitAngleTypeMenu(QMenu *menu, vidtype pieceId, QHash<int, QAct
PieceNodeAngle curType = PieceNodeAngle::ByLength; PieceNodeAngle curType = PieceNodeAngle::ByLength;
const VPiece detail = VAbstractTool::data.GetPiece(pieceId); const VPiece detail = VAbstractTool::data.GetPiece(pieceId);
const int nodeIndex = detail.GetPath().indexOfNode(m_id); const VPiecePath &path = detail.GetPath();
const int nodeIndex = path.indexOfNode(m_id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
const VPieceNode &node = detail.GetPath().at(nodeIndex); curType = path.at(nodeIndex).GetAngleType();
curType = node.GetAngleType();
angleTypeMenu->setEnabled(detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn()); angleTypeMenu->setEnabled(detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn());
} }
@ -438,10 +439,11 @@ void VNodePoint::InitPassmarkAngleTypeMenu(QMenu *menu, vidtype pieceId, QHash<i
PassmarkAngleType passmarkAngleCurType = PassmarkAngleType::Straightforward; PassmarkAngleType passmarkAngleCurType = PassmarkAngleType::Straightforward;
const VPiece detail = VAbstractTool::data.GetPiece(pieceId); const VPiece detail = VAbstractTool::data.GetPiece(pieceId);
const int nodeIndex = detail.GetPath().indexOfNode(m_id); const VPiecePath &path = detail.GetPath();
const int nodeIndex = path.indexOfNode(m_id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
const VPieceNode &node = detail.GetPath().at(nodeIndex); const VPieceNode &node = path.at(nodeIndex);
passmarkAngleMenu->setEnabled(node.IsPassmark()); passmarkAngleMenu->setEnabled(node.IsPassmark());
passmarkAngleCurType = node.GetPassmarkAngleType(); passmarkAngleCurType = node.GetPassmarkAngleType();
} }
@ -489,10 +491,11 @@ void VNodePoint::InitPassmarkLineTypeMenu(QMenu *menu, vidtype pieceId, QHash<in
PassmarkLineType passmarkLineCurType = PassmarkLineType::OneLine; PassmarkLineType passmarkLineCurType = PassmarkLineType::OneLine;
const VPiece detail = VAbstractTool::data.GetPiece(pieceId); const VPiece detail = VAbstractTool::data.GetPiece(pieceId);
const int nodeIndex = detail.GetPath().indexOfNode(m_id); const VPiecePath &path = detail.GetPath();
const int nodeIndex = path.indexOfNode(m_id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
const VPieceNode &node = detail.GetPath().at(nodeIndex); const VPieceNode &node = path.at(nodeIndex);
passmarkLineTypeMenu->setEnabled(node.IsPassmark()); passmarkLineTypeMenu->setEnabled(node.IsPassmark());
passmarkLineCurType = node.GetPassmarkLineType(); passmarkLineCurType = node.GetPassmarkLineType();
} }
@ -550,10 +553,11 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
bool isPassmark = false; bool isPassmark = false;
const VPiece detail = VAbstractTool::data.GetPiece(piece->getId()); const VPiece detail = VAbstractTool::data.GetPiece(piece->getId());
const int nodeIndex = detail.GetPath().indexOfNode(m_id); const VPiecePath &path = detail.GetPath();
const int nodeIndex = path.indexOfNode(m_id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
const VPieceNode &node = detail.GetPath().at(nodeIndex); const VPieceNode &node = path.at(nodeIndex);
angleCurType = node.GetAngleType(); angleCurType = node.GetAngleType();
passmarkAngleCurType = node.GetPassmarkAngleType(); passmarkAngleCurType = node.GetPassmarkAngleType();
passmarkLineCurType = node.GetPassmarkLineType(); passmarkLineCurType = node.GetPassmarkLineType();

View File

@ -1404,9 +1404,10 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat
void VToolSeamAllowance::UpdateExcludeState() void VToolSeamAllowance::UpdateExcludeState()
{ {
const VPiece detail = VAbstractTool::data.GetPiece(m_id); const VPiece detail = VAbstractTool::data.GetPiece(m_id);
for (int i = 0; i< detail.GetPath().CountNodes(); ++i) const VPiecePath &path = detail.GetPath();
for (int i = 0; i < path.CountNodes(); ++i)
{ {
const VPieceNode &node = detail.GetPath().at(i); const VPieceNode &node = path.at(i);
if (node.GetTypeTool() == Tool::NodePoint) if (node.GetTypeTool() == Tool::NodePoint)
{ {
auto *tool = qobject_cast<VNodePoint*>(VAbstractPattern::getTool(node.GetId())); auto *tool = qobject_cast<VNodePoint*>(VAbstractPattern::getTool(node.GetId()));
@ -1970,9 +1971,10 @@ auto VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData &geom,
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *scene) void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *scene)
{ {
for (int i = 0; i< detail.GetPath().CountNodes(); ++i) const VPiecePath &path = detail.GetPath();
for (int i = 0; i < path.CountNodes(); ++i)
{ {
const VPieceNode &node = detail.GetPath().at(i); const VPieceNode &node = path.at(i);
InitNode(node, scene, this); InitNode(node, scene, this);
doc->IncrementReferens(VAbstractTool::data.GetGObject(node.GetId())->getIdTool()); doc->IncrementReferens(VAbstractTool::data.GetGObject(node.GetId())->getIdTool());
} }

View File

@ -27,6 +27,7 @@
*************************************************************************/ *************************************************************************/
#include "vpiecegrainline.h" #include "vpiecegrainline.h"
#include "../vgeometry/vabstractcurve.h" #include "../vgeometry/vabstractcurve.h"
#include "compatibility.h"
#include "qmath.h" #include "qmath.h"
#include "vpiecegrainline_p.h" #include "vpiecegrainline_p.h"
@ -137,14 +138,13 @@ void VPieceGrainline::SetEnabled(bool enabled)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPieceGrainline::SecondaryLine() const -> QLineF auto VPieceGrainline::SecondaryLine() const -> QLineF
{ {
QLineF mainLine = GetMainLine(); const QLineF mainLine = GetMainLine();
QLineF secondaryLine = mainLine; const QPointF center = LineCenter(mainLine);
QTransform t; QTransform t;
t.translate(mainLine.center().x(), mainLine.center().y()); t.translate(center.x(), center.y());
t.rotate(90); t.rotate(90);
t.translate(-mainLine.center().x(), -mainLine.center().y()); t.translate(-center.x(), -center.y());
secondaryLine = t.map(secondaryLine); return t.map(mainLine);
return secondaryLine;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -34,6 +34,10 @@
#include <QLineF> #include <QLineF>
#include <QSharedData> #include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "../vmisc/vdatastreamenum.h"
#endif
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor") QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")