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)
# include "../vmisc/vdatastreamenum.h"
#endif
#include "../ifc/exception/vexception.h"
#include <QCoreApplication>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,12 +28,13 @@
#ifndef COMPATIBILITY_H
#define COMPATIBILITY_H
#include <QtGlobal>
#include <QStringList>
#include <QSet>
#include <QVector>
#include <QFontMetrics>
#include <QLibraryInfo>
#include <QLineF>
#include <QSet>
#include <QStringList>
#include <QVector>
#include <QtGlobal>
#include "defglobal.h"
@ -360,4 +361,14 @@ inline auto QLibraryPath(T loc) -> QString
#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

View File

@ -32,6 +32,7 @@
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/varc.h"
#include "../vlayout/vrawsapoint.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/testpath.h" // do not remove
#include "../vmisc/vabstractvalapplication.h"
#include "../vpatterndb/testpassmark.h" // do not remove
@ -363,7 +364,7 @@ auto CreateTMarkPassmark(const VPiecePassmarkData &passmarkData, const QLineF &l
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
#include "../dialogtool.h"
#include "../vgeometry/vplacelabelitem.h"
#include "../vpatterndb/vpiece.h"
#include "../vpatterndb/vpiecepath.h"
@ -46,7 +47,6 @@ namespace Ui
class VisPieceSpecialPoints;
class FancyTabBar;
class VPlaceLabelItem;
class VUndoCommand;
class DialogSeamAllowance : public DialogTool

View File

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

View File

@ -1404,9 +1404,10 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat
void VToolSeamAllowance::UpdateExcludeState()
{
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)
{
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)
{
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);
doc->IncrementReferens(VAbstractTool::data.GetGObject(node.GetId())->getIdTool());
}

View File

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

View File

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