Compare commits

...

22 Commits

Author SHA1 Message Date
Roman Telezhynskyi d896fa01fc Disables all the APIs deprecated before Qt 6.7.0. 2024-04-17 21:25:45 +03:00
Roman Telezhynskyi d67df44d9c Ship Qt's translation together with AppImage. 2024-04-17 21:25:22 +03:00
Roman Telezhynskyi 161d019f29 Fix compiler warnings. 2024-04-17 20:44:30 +03:00
Roman Telezhynskyi 4729d51dd5 Fix piece node style. 2024-04-17 20:26:23 +03:00
Roman Telezhynskyi 1394204c65 Changing curved path settings should not trigger visibility of control points. 2024-04-17 17:55:02 +03:00
Roman Telezhynskyi b78adf9264 Fix piece label issue.
Rotation caused label font change.
2024-04-17 16:35:29 +03:00
Roman Telezhynskyi 3424f34354 Fix Seam Allowance Issue. 2024-04-17 15:17:39 +03:00
Roman Telezhynskyi 5199f4d4bc Refactoring.
Use a static QRegularExpression object to avoid recreating the regular expressions.
2024-04-17 13:05:42 +03:00
Roman Telezhynskyi f1081a2aad Refactoring.
Fix places that could use a reserve() call.
2024-04-17 13:02:25 +03:00
Roman Telezhynskyi afd948b330 Refactoring.
Fix places defining containers inside loops.
2024-04-17 12:53:23 +03:00
Roman Telezhynskyi 8063645cf6 Refactoring.
A "constexpr" function should not be declared "inline".
2024-04-17 11:46:37 +03:00
Roman Telezhynskyi 47a589c8d8 Refactoring.
Remove deprecated constexpr macros.
2024-04-17 11:43:48 +03:00
Roman Telezhynskyi 6e6629b77c Refactoring. 2024-04-16 18:20:53 +03:00
Roman Telezhynskyi 708d626524 No support for tok_001 locale. 2024-04-16 17:53:00 +03:00
Roman Telezhynskyi 745c5de5d6 Refactoring.
Remove the top level "const" qualifier from the return type of a function.
2024-04-16 17:34:23 +03:00
Roman Telezhynskyi 1ddb07f2ee Refactoring.
Avoid unnecessary copy by using a "const" reference.
2024-04-16 17:12:32 +03:00
Roman Telezhynskyi 0080ce8ef5 Refactoring.
Overriding member functions should do more than simply call the same member in the base class.
2024-04-16 15:12:54 +03:00
Roman Telezhynskyi 8c90fd0367 Refactoring.
"bool" expressions should not be used as operands to built-in operators.
2024-04-16 14:54:56 +03:00
Roman Telezhynskyi 14d92ba834 Fix copy past error. 2024-04-16 14:48:55 +03:00
Roman Telezhynskyi 8ccc5c6c8f "constexpr" literal operators should be "consteval". 2024-04-16 14:48:37 +03:00
Roman Telezhynskyi f46197740d Refactoring.
Switch to using std::chrono.
2024-04-16 11:47:13 +03:00
Roman Telezhynskyi 5b92408fee Fix conflict with macros on Windows. 2024-04-16 11:46:02 +03:00
72 changed files with 820 additions and 348 deletions

View File

@ -41,6 +41,7 @@ AppDir:
- qt515imageformats
- qt515svg
- qt515xmlpatterns
- qt515translations
- libpango-1.0-0
files:
include: []
@ -89,6 +90,20 @@ AppDir:
- opt/qt515/plugins/egldeviceintegrations
- opt/qt515/plugins/platforminputcontexts
- opt/qt515/plugins/sqldrivers
- /opt/qt515/translations/assistant*.qm
- /opt/qt515/translations/designer*.qm
- /opt/qt515/translations/linguist*.qm
- /opt/qt515/translations/qt_help*.qm
- /opt/qt515/translations/qtconnectivity*.qm
- /opt/qt515/translations/qtdeclarative*.qm
- /opt/qt515/translations/qtlocation*.qm
- /opt/qt515/translations/qtmultimedia*.qm
- /opt/qt515/translations/qtquickcontrols2*.qm
- /opt/qt515/translations/qtquickcontrols*.qm
- /opt/qt515/translations/qtscript*.qm
- /opt/qt515/translations/qtserialport*.qm
- /opt/qt515/translations/qtwebengine*.qm
- /opt/qt515/translations/qtwebsockets*.qm
runtime:
env:
APPDIR_LIBRARY_PATH: "$APPDIR:$APPDIR/runtime/compat/:$APPDIR/opt/qt515/lib:$APPDIR/usr/lib/x86_64-linux-gnu:$APPDIR/lib/x86_64-linux-gnu:$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders:$APPDIR/usr/local/lib/valentina"

View File

@ -127,7 +127,7 @@ Module {
// You can make your code fail to compile if it uses deprecated APIs.
// In order to do so, uncomment the following line.
"QT_DISABLE_DEPRECATED_BEFORE=0x060600", // disables all the APIs deprecated before Qt 6.6.0
"QT_DISABLE_DEPRECATED_BEFORE=0x060700", // disables all the APIs deprecated before Qt 6.7.0
// Since Qt 5.4.0 the source code location is recorded only in debug builds.
// We need this information also in release builds. For this need define QT_MESSAGELOGCONTEXT.
@ -149,7 +149,6 @@ Module {
if (enableAppImage && qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos"))
defines.push('APPIMAGE');
defines.push('APPIMAGE_QT_TRANSLATIONS="' + FileInfo.joinPaths(qbs.installPrefix, "translations") + '"');
if (enableMultiBundle)
defines.push('MULTI_BUNDLE');

View File

@ -95,7 +95,7 @@ auto LinesToString(const QVector<QLineF> &lines) -> QString
{
QStringList l;
l.reserve(lines.size());
for (auto line : lines)
for (const auto &line : lines)
{
l.append(LineToString(line));
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<pattern labelPrefix="en" passmarkLength="">
<!--Pattern created with Valentina v0.7.52.0 (https://smart-pattern.com.ua/).-->
<version>0.9.2</version>
<version>0.9.1</version>
<unit>cm</unit>
<description>Jeans mit gerader Seitennaht
Müller u. Sohn Zeitschrift Ausgabe 10.20 , Seite 47-50 vom PDf (bzw. 14 - 17 vom Herrenteil)</description>

View File

@ -214,7 +214,8 @@ auto PreferencesConfigurationPage::Apply() -> QStringList
QTimer *autoSaveTimer = VApplication::VApp()->getAutoSaveTimer();
SCASSERT(autoSaveTimer)
ui->autoSaveCheck->isChecked() ? autoSaveTimer->start(ui->autoTime->value() * 60000) : autoSaveTimer->stop();
ui->autoSaveCheck->isChecked() ? autoSaveTimer->start(std::chrono::minutes{ui->autoTime->value()})
: autoSaveTimer->stop();
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());

View File

@ -38,7 +38,6 @@
#include <QMenu>
#include <QTimer>
#include <QUndoStack>
#include <chrono>
using namespace std::chrono_literals;

View File

@ -1989,20 +1989,20 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
csv.toCSV(fileName, error, withHeader, separator, VTextCodec::codecForMib(mib));
}
#if defined(Q_OS_MAC)
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarStyle(QToolBar *bar) const
{
MainWindowsNoGUI::ToolBarStyle(bar);
#if defined(Q_OS_MAC)
// Temporary fix issue with toolbar black background on mac with OpenGL render
if (VAbstractValApplication::VApp()->getSceneView() &&
VAbstractValApplication::VApp()->getSceneView()->IsOpenGLRender())
{
bar->setStyle(QStyleFactory::create("fusion"));
}
#endif
}
#endif
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ScaleChanged(qreal scale)
@ -6256,7 +6256,7 @@ void MainWindow::InitAutoSave()
if (VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveState())
{
const qint32 autoTime = VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveTime();
m_autoSaveTimer->start(autoTime * 60000);
m_autoSaveTimer->start(std::chrono::minutes{autoTime});
qCDebug(vMainWindow, "Autosaving each %d minutes.", autoTime);
}
VApplication::VApp()->setAutoSaveTimer(m_autoSaveTimer);

View File

@ -121,7 +121,9 @@ protected:
void CleanLayout() override;
void PrepareSceneList(PreviewQuatilty quality) override;
void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) override;
#if defined(Q_OS_MAC)
void ToolBarStyle(QToolBar *bar) const override;
#endif
private slots:
void ScaleChanged(qreal scale);
void MouseMove(const QPointF &scenePos);

View File

@ -76,6 +76,7 @@
#include <QWinTaskbarProgress>
#endif
using namespace std::chrono_literals;
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
@ -234,7 +235,7 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
progressTimer->deleteLater();
}
});
progressTimer->start(1000);
progressTimer->start(1s);
}
LayoutErrors nestingState = LayoutErrors::NoError;

View File

@ -414,6 +414,7 @@ auto VAbstractPattern::GetActivDrawElement(QDomElement &element) const -> bool
auto VAbstractPattern::getLocalHistory(const QString &draw) const -> QVector<VToolRecord>
{
QVector<VToolRecord> historyPP;
historyPP.reserve(history.size());
for (qint32 i = 0; i < history.size(); ++i)
{
const VToolRecord &tool = history.at(i);
@ -733,8 +734,9 @@ auto VAbstractPattern::ParsePieceNodes(const QDomElement &domElement) -> VPieceP
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>
{
QVector<CustomSARecord> records;
const QDomNodeList nodeList = domElement.childNodes();
QVector<CustomSARecord> records;
records.reserve(nodeList.size());
for (qint32 i = 0; i < nodeList.size(); ++i)
{
const QDomElement element = nodeList.at(i).toElement();
@ -756,8 +758,9 @@ auto VAbstractPattern::ParsePieceCSARecords(const QDomElement &domElement) -> QV
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPattern::ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>
{
QVector<quint32> records;
const QDomNodeList nodeList = domElement.childNodes();
QVector<quint32> records;
records.reserve(nodeList.size());
for (qint32 i = 0; i < nodeList.size(); ++i)
{
const QDomElement element = nodeList.at(i).toElement();
@ -1759,6 +1762,7 @@ auto VAbstractPattern::ListIncrements() const -> QStringList
auto GetExpressions = [&increments, this](const QString &type)
{
const QDomNodeList list = elementsByTagName(type);
increments.reserve(list.size());
for (int i = 0; i < list.size(); ++i)
{
const QString name = GetParametrEmptyString(list.at(i).toElement(), AttrName);
@ -2612,6 +2616,8 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
QDomElement const groups = CreateGroups(patternPieceName);
if (not groups.isNull())
{
QVector<QPair<quint32, quint32>> items;
QDomNode domNode = groups.firstChild();
while (not domNode.isNull())
{
@ -2630,10 +2636,11 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
groupData.tags = FilterGroupTags(GetParametrEmptyString(group, AttrTags));
groupData.tool = GetParametrUInt(group, AttrTool, NULL_ID_STR);
QVector<QPair<quint32, quint32>> items;
items.resize(0);
const QDomNodeList nodeList = group.childNodes();
const qint32 num = nodeList.size();
items.reserve(num);
for (qint32 i = 0; i < num; ++i)
{
const QDomElement element = nodeList.at(i).toElement();

View File

@ -1149,8 +1149,9 @@ void VDomDocument::SetLabelTemplate(QDomElement &element, const QVector<VLabelTe
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::ValidateVersion(const QString &version)
{
const QRegularExpression rx(QStringLiteral("^([0-9]|[1-9][0-9]|[1-2][0-5][0-5]).([0-9]|[1-9][0-9]|[1-2][0-5][0-5])"
".([0-9]|[1-9][0-9]|[1-2][0-5][0-5])$"));
static const QRegularExpression rx(
QStringLiteral("^([0-9]|[1-9][0-9]|[1-2][0-5][0-5]).([0-9]|[1-9][0-9]|[1-2][0-5][0-5])"
".([0-9]|[1-9][0-9]|[1-2][0-5][0-5])$"));
if (!rx.match(version).hasMatch())
{

View File

@ -43,8 +43,8 @@ public:
static const QString KnownMeasurementsMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned KnownMeasurementsMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned KnownMeasurementsMaxVer = FormatVersion(1, 0, 0);
static constexpr const unsigned KnownMeasurementsMinVer = FormatVersion(1, 0, 0);
static constexpr const unsigned KnownMeasurementsMaxVer = FormatVersion(1, 0, 0);
static auto XSDSchemas() -> QHash<unsigned, QString>;

View File

@ -40,8 +40,8 @@ public:
static const QString LabelTemplateMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMaxVer = FormatVersion(1, 0, 0);
static constexpr const unsigned LabelTemplateMinVer = FormatVersion(1, 0, 0);
static constexpr const unsigned LabelTemplateMaxVer = FormatVersion(1, 0, 0);
static auto XSDSchemas() -> QHash <unsigned, QString>;

View File

@ -46,8 +46,8 @@ public:
static const QString LayoutMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned LayoutMinVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 9);
static constexpr const unsigned LayoutMinVer = FormatVersion(0, 1, 0);
static constexpr const unsigned LayoutMaxVer = FormatVersion(0, 1, 9);
static auto XSDSchemas() -> QHash<unsigned, QString>;

View File

@ -1186,13 +1186,15 @@ void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling)
// TODO. Delete if minimal supported version is 0.2.4
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code.");
QVector<quint32> children;
QDomElement node = modeling.firstChild().toElement();
while (not node.isNull())
{
if (node.tagName() == *strTools)
{
const quint32 toolId = node.attribute(*strId).toUInt();
QVector<quint32> children;
children.resize(0);
QDomElement childNode = node.nextSibling().toElement();
while (not childNode.isNull())
{
@ -2221,6 +2223,8 @@ void VPatternConverter::TagUnionDetailsToV0_4_0()
// TODO. Delete if minimal supported version is 0.4.0
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
QVector<QDomElement> nodes;
const QDomNodeList list = elementsByTagName(*strTools);
for (int i = 0; i < list.size(); ++i)
{
@ -2230,10 +2234,11 @@ void VPatternConverter::TagUnionDetailsToV0_4_0()
{
const QStringList tags = QStringList() << *strDet << *strChildren;
QVector<QDomElement> nodes;
nodes.resize(0);
QDomElement tagChildrenNodes = createElement(*strChildren);
const QDomNodeList childList = toolDOM.childNodes();
nodes.reserve(childList.size());
for (qint32 i = 0; i < childList.size(); ++i)
{
const QDomElement element = childList.at(i).toElement();

View File

@ -53,8 +53,8 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 5);
static constexpr const unsigned PatternMinVer = FormatVersion(0, 1, 4);
static constexpr const unsigned PatternMaxVer = FormatVersion(0, 9, 5);
static auto XSDSchemas() -> QHash<unsigned, QString>;

View File

@ -48,8 +48,8 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 2, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 6, 1);
static constexpr const unsigned MeasurementMinVer = FormatVersion(0, 2, 0);
static constexpr const unsigned MeasurementMaxVer = FormatVersion(0, 6, 1);
static auto XSDSchemas() -> QHash<unsigned, QString>;

View File

@ -48,8 +48,8 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 6, 1);
static constexpr const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
static constexpr const unsigned MeasurementMaxVer = FormatVersion(0, 6, 1);
static auto XSDSchemas() -> QHash<unsigned, QString>;

View File

@ -39,8 +39,8 @@ public:
static const QString WatermarkMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned WatermarkMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned WatermarkMaxVer = FormatVersion(1, 1, 0);
static constexpr const unsigned WatermarkMinVer = FormatVersion(1, 0, 0);
static constexpr const unsigned WatermarkMaxVer = FormatVersion(1, 1, 0);
static auto XSDSchemas() -> QHash <unsigned, QString>;

View File

@ -408,11 +408,12 @@ auto FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos
auto SupportedLocale(const QLocale &locale) -> bool
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return locale.positiveSign().size() == 1 && locale.negativeSign().size() == 1 && locale.toString(0).size() == 1 &&
locale.toString(1).size() == 1 && locale.toString(2).size() == 1 && locale.toString(3).size() == 1 &&
locale.toString(4).size() == 1 && locale.toString(5).size() == 1 && locale.toString(6).size() == 1 &&
locale.toString(7).size() == 1 && locale.toString(8).size() == 1 && locale.toString(9).size() == 1 &&
locale.exponential().size() == 1 && locale.decimalPoint().size() == 1 && locale.groupSeparator().size() == 1;
return locale.name() != QStringLiteral("tok_001") && locale.positiveSign().size() == 1 &&
locale.negativeSign().size() == 1 && locale.toString(0).size() == 1 && locale.toString(1).size() == 1 &&
locale.toString(2).size() == 1 && locale.toString(3).size() == 1 && locale.toString(4).size() == 1 &&
locale.toString(5).size() == 1 && locale.toString(6).size() == 1 && locale.toString(7).size() == 1 &&
locale.toString(8).size() == 1 && locale.toString(9).size() == 1 && locale.exponential().size() == 1 &&
locale.decimalPoint().size() == 1 && locale.groupSeparator().size() == 1;
#else
Q_UNUSED(locale)
return true;

View File

@ -675,12 +675,6 @@ public:
flags = 0;
name = "";
}
protected:
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override
{
return DRW_TableEntry::parseCode(code, reader);
}
};
namespace DRW

View File

@ -309,12 +309,6 @@ void VDxfEngine::drawLines(const QLineF *lines, int lineCount)
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::drawLines(const QLine *lines, int lineCount)
{
QPaintEngine::drawLines(lines, lineCount);
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
@ -377,12 +371,6 @@ void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::drawPolygon(const QPoint *points, int pointCount, QPaintEngine::PolygonDrawMode mode)
{
QPaintEngine::drawPolygon(points, pointCount, mode);
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::drawEllipse(const QRectF &rect)
{
@ -424,12 +412,6 @@ void VDxfEngine::drawEllipse(const QRectF &rect)
m_input->AddEntity(ellipse);
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::drawEllipse(const QRect &rect)
{
QPaintEngine::drawEllipse(rect);
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{

View File

@ -67,6 +67,10 @@ class VDxfEngine final : public QPaintEngine
friend class VDxfPaintDevice;
public:
using QPaintEngine::drawEllipse;
using QPaintEngine::drawLines;
using QPaintEngine::drawPolygon;
VDxfEngine();
~VDxfEngine() override;
@ -79,11 +83,8 @@ public:
void drawPath(const QPainterPath &path) override;
void drawLines(const QLineF *lines, int lineCount) override;
void drawLines(const QLine *lines, int lineCount) override;
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
void drawEllipse(const QRectF &rect) override;
void drawEllipse(const QRect &rect) override;
void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;

View File

@ -33,16 +33,18 @@
//---------------------------------------------------------------------------------------------------------------------
VAbstartMeasurementDimension::VAbstartMeasurementDimension(Unit units)
: m_units(units)
{}
: m_units(units)
{
}
//---------------------------------------------------------------------------------------------------------------------
VAbstartMeasurementDimension::VAbstartMeasurementDimension(Unit units, qreal min, qreal max, qreal step)
: m_units(units),
m_minValue(min),
m_maxValue(max),
m_step(step)
{}
: m_units(units),
m_minValue(min),
m_maxValue(max),
m_step(step)
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::IsValid() -> bool
@ -60,7 +62,7 @@ auto VAbstartMeasurementDimension::RangeMin() const -> int
const int rangeMinMm = 200;
const int rangeMinInch = 8;
switch(Units())
switch (Units())
{
case Unit::Cm:
return rangeMinCm;
@ -85,7 +87,7 @@ auto VAbstartMeasurementDimension::RangeMax() const -> int
const int rangeMaxMm = 2720;
const int rangeMaxInch = 107;
switch(Units())
switch (Units())
{
case Unit::Cm:
return rangeMaxCm;
@ -135,8 +137,7 @@ auto VAbstartMeasurementDimension::ValidSteps() const -> QVector<qreal>
}
candidate = 1 + s * i;
++i;
}
while(candidate < stepBarrier);
} while (candidate < stepBarrier);
}
return steps;
@ -159,12 +160,11 @@ auto VAbstartMeasurementDimension::ValidBasesList() const -> QStringList
list.append(QString::number(base));
}
return list;
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::ValidBases(qreal min, qreal max, qreal step,
const QSet<qreal> &exclude) -> QVector<qreal>
auto VAbstartMeasurementDimension::ValidBases(qreal min, qreal max, qreal step, const QSet<qreal> &exclude)
-> QVector<qreal>
{
QVector<qreal> validBases;
@ -190,8 +190,7 @@ auto VAbstartMeasurementDimension::ValidBases(qreal min, qreal max, qreal step,
}
value = min + step * i;
++i;
}
while(value < max + step);
} while (value < max + step);
if (validBases.isEmpty())
{
@ -202,8 +201,7 @@ auto VAbstartMeasurementDimension::ValidBases(qreal min, qreal max, qreal step,
validBases.append(value);
value = min + step * i;
++i;
}
while(value < max + step);
} while (value < max + step);
}
return validBases;
@ -265,7 +263,7 @@ auto VAbstartMeasurementDimension::IsUnitsValid() const -> bool
//---------------------------------------------------------------------------------------------------------------------
auto VAbstartMeasurementDimension::DimensionName(MeasurementDimension type) -> QString
{
switch(type)
switch (type)
{
case MeasurementDimension::X:
return QCoreApplication::translate("VAbstartMeasurementDimension", "Height", "dimension");
@ -288,7 +286,7 @@ auto VAbstartMeasurementDimension::DimensionToolTip(const MeasurementDimension_p
return {};
}
switch(dimension->Type())
switch (dimension->Type())
{
case MeasurementDimension::Y:
if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement())
@ -326,51 +324,59 @@ auto VAbstartMeasurementDimension::DimensionToolTip(const MeasurementDimension_p
// VXMeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
VXMeasurementDimension::VXMeasurementDimension(Unit units)
: VAbstartMeasurementDimension(units)
{}
: VAbstartMeasurementDimension(units)
{
}
//---------------------------------------------------------------------------------------------------------------------
VXMeasurementDimension::VXMeasurementDimension(Unit units, qreal min, qreal max, qreal step)
: VAbstartMeasurementDimension(units, min, max, step)
{}
: VAbstartMeasurementDimension(units, min, max, step)
{
}
// VYMeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
VYMeasurementDimension::VYMeasurementDimension(Unit units)
: VAbstartMeasurementDimension(units)
{}
: VAbstartMeasurementDimension(units)
{
}
//---------------------------------------------------------------------------------------------------------------------
VYMeasurementDimension::VYMeasurementDimension(Unit units, qreal min, qreal max, qreal step)
: VAbstartMeasurementDimension(units, min, max, step)
{}
: VAbstartMeasurementDimension(units, min, max, step)
{
}
// VWMeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
VWMeasurementDimension::VWMeasurementDimension(Unit units)
: VAbstartMeasurementDimension(units)
{}
: VAbstartMeasurementDimension(units)
{
}
//---------------------------------------------------------------------------------------------------------------------
VWMeasurementDimension::VWMeasurementDimension(Unit units, qreal min, qreal max, qreal step)
: VAbstartMeasurementDimension(units, min, max, step)
{}
: VAbstartMeasurementDimension(units, min, max, step)
{
}
// VZMeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
VZMeasurementDimension::VZMeasurementDimension(Unit units)
: VAbstartMeasurementDimension(units)
{}
: VAbstartMeasurementDimension(units)
{
}
//---------------------------------------------------------------------------------------------------------------------
VZMeasurementDimension::VZMeasurementDimension(Unit units, qreal min, qreal max, qreal step)
: VAbstartMeasurementDimension(units, min, max, step)
{}
: VAbstartMeasurementDimension(units, min, max, step)
{
}
// VDimensionRestriction
//---------------------------------------------------------------------------------------------------------------------
VDimensionRestriction::VDimensionRestriction(qreal min, qreal max, const QString &exclude) :
m_min(min),
VDimensionRestriction::VDimensionRestriction(qreal min, qreal max, const QString &exclude)
: m_min(min),
m_max(max)
{
SetExcludeString(exclude);
@ -399,6 +405,7 @@ auto VDimensionRestriction::GetExcludeString() const -> QString
{
QList<qreal> const list = m_exclude.values();
QStringList excludeList;
excludeList.reserve(list.size());
for (const auto &value : list)
{

View File

@ -298,13 +298,11 @@ void VGAnalytics::SendAppCloseEvent(qint64 engagementTimeMsec)
};
SendEvent(QStringLiteral("vapp_close"), params);
QNetworkReply *reply = d->PostMessage();
if (reply)
if (QNetworkReply *reply = d->SendAnalytics())
{
QTimer timer;
const int timeoutSeconds = 3; // Wait for 3 seconds
timer.setSingleShot(true);
timer.start(timeoutSeconds * 1000);
timer.start(3s);
QEventLoop loop;
connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);

View File

@ -78,7 +78,7 @@ VGAnalyticsWorker::VGAnalyticsWorker(QObject *parent)
m_screenScaleFactor = screen->logicalDotsPerInchX() / 96.0;
m_timer.setInterval(m_timerInterval);
connect(&m_timer, &QTimer::timeout, this, &VGAnalyticsWorker::PostMessage);
connect(&m_timer, &QTimer::timeout, this, &VGAnalyticsWorker::SendAnalytics);
}
//---------------------------------------------------------------------------------------------------------------------
@ -203,7 +203,7 @@ void VGAnalyticsWorker::EnqueQueryWithCurrentTime(const QJsonObject &query)
* The message POST is asyncroniously when the server
* answered a signal will be emitted.
*/
auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
auto VGAnalyticsWorker::SendAnalytics() -> QNetworkReply *
{
if (m_messageQueue.isEmpty())
{
@ -229,7 +229,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
{
// too old.
m_messageQueue.dequeue();
return PostMessage();
return SendAnalytics();
}
QByteArray const requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact);
@ -258,7 +258,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
}
QNetworkReply *reply = networkManager->post(m_request, requestJson);
connect(reply, &QNetworkReply::finished, this, &VGAnalyticsWorker::PostMessageFinished);
connect(reply, &QNetworkReply::finished, this, &VGAnalyticsWorker::SendAnalyticsFinished);
return reply;
}
@ -272,7 +272,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
* If message couldn't be send then next try is when the
* timer emits its signal.
*/
void VGAnalyticsWorker::PostMessageFinished()
void VGAnalyticsWorker::SendAnalyticsFinished()
{
auto *reply = qobject_cast<QNetworkReply *>(sender());
@ -289,6 +289,6 @@ void VGAnalyticsWorker::PostMessageFinished()
LogMessage(VGAnalytics::Debug, QStringLiteral("Message sent"));
m_messageQueue.dequeue();
PostMessage();
SendAnalytics();
reply->deleteLater();
}

View File

@ -91,8 +91,8 @@ public:
void Enable(bool state);
public slots:
QNetworkReply *PostMessage(); // NOLINT(modernize-use-trailing-return-type)
void PostMessageFinished();
QNetworkReply *SendAnalytics(); // NOLINT(modernize-use-trailing-return-type)
void SendAnalyticsFinished();
private:
Q_DISABLE_COPY_MOVE(VGAnalyticsWorker) // NOLINT

View File

@ -523,7 +523,7 @@ auto VAbstractCubicBezier::GetParmT(qreal length) const -> qreal
length = base;
}
Q_DECL_RELAXED_CONSTEXPR qreal eps = ToPixel(0.00001, Unit::Mm);
constexpr qreal eps = ToPixel(0.00001, Unit::Mm);
qreal parT = 0.5;
qreal step = parT;
qreal splLength = 0;

View File

@ -611,7 +611,7 @@ auto VAbstractCurve::ShowDirection(const QVector<DirectionArrow> &arrows, qreal
{
QPainterPath path;
for (auto arrow : arrows)
for (const auto &arrow : arrows)
{
if (not arrow.first.isNull() && not arrow.second.isNull())
{

View File

@ -72,7 +72,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, mCI, ("CI"_L1)) // NOLINT circle
QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto ConvertPixels(qreal pix) -> qreal
constexpr auto ConvertPixels(qreal pix) -> qreal
{
// Default plating measurement in the HP-GL(HP-GL/2) graphics mode is 1/1016"(0.025mm).
// 40 plotter units = 1 mm

View File

@ -75,7 +75,7 @@ inline auto IsOutsidePoint(QPointF p1, QPointF p2, QPointF px) -> bool
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR auto PointPosition(const QPointF &p, const QLineF &line) -> qreal
constexpr auto PointPosition(const QPointF &p, const QLineF &line) -> qreal
{
return (line.p2().x() - line.p1().x()) * (p.y() - line.p1().y()) -
(line.p2().y() - line.p1().y()) * (p.x() - line.p1().x());
@ -1258,6 +1258,12 @@ auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Lin
}
return points;
}
else if (a > 345)
{
points.append(VRawSAPoint(bigLine1.p2(), p2Line1.CurvePoint(), p2Line1.TurnPoint()));
points.append(VRawSAPoint(bigLine2.p1(), p2Line1.CurvePoint(), p2Line1.TurnPoint()));
return points;
}
QPointF crosPoint;
const QLineF::IntersectType type = bigLine1.intersects(bigLine2, &crosPoint);

View File

@ -221,18 +221,19 @@ template <class T>
inline auto VAbstractPiece::CheckPointOnLine(QVector<T> &points, const T &iPoint, const T &prevPoint,
const T &nextPoint) -> bool
{
if (not IsEkvPointOnLine(iPoint, prevPoint, nextPoint))
if (!VGObject::IsPointOnLineSegment(iPoint, prevPoint, nextPoint) ||
!IsEkvPointOnLine(iPoint, prevPoint, nextPoint))
{
points.append(iPoint);
return false;
}
if (not points.isEmpty() && iPoint.TurnPoint())
if (!points.isEmpty() && iPoint.TurnPoint())
{
points.last().SetTurnPoint(true);
}
if (not points.isEmpty() && iPoint.CurvePoint())
if (!points.isEmpty() && iPoint.CurvePoint())
{
points.last().SetCurvePoint(true);
}
@ -245,7 +246,7 @@ template <>
inline auto VAbstractPiece::CheckPointOnLine<QPointF>(QVector<QPointF> &points, const QPointF &iPoint,
const QPointF &prevPoint, const QPointF &nextPoint) -> bool
{
if (not IsEkvPointOnLine(iPoint, prevPoint, nextPoint))
if (!VGObject::IsPointOnLineSegment(iPoint, prevPoint, nextPoint, accuracyPointOnLine / 4.))
{
points.append(iPoint);
return false;

View File

@ -33,7 +33,7 @@
namespace
{
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto Square(QSizeF size) -> qint64
constexpr auto Square(QSizeF size) -> qint64
{
return static_cast<qint64>(size.width() * size.height());
}

View File

@ -680,6 +680,7 @@ auto VLayoutGenerator::MoveDetails(qreal length, const QVector<VLayoutPiece> &de
}
QList<VLayoutPiece> newDetails;
newDetails.reserve(details.size());
for (auto d : details)
{
IsPortrait() ? d.Translate(0, length) : d.Translate(length, 0);

View File

@ -41,15 +41,15 @@ QT_WARNING_DISABLE_CLANG("-Wnon-virtual-dtor")
class VLayoutPoint : public QPointF
{
public:
Q_DECL_CONSTEXPR VLayoutPoint() = default;
Q_DECL_CONSTEXPR VLayoutPoint(qreal xpos, qreal ypos);
Q_DECL_CONSTEXPR explicit VLayoutPoint(QPointF p);
constexpr VLayoutPoint() = default;
constexpr VLayoutPoint(qreal xpos, qreal ypos);
constexpr explicit VLayoutPoint(QPointF p);
Q_DECL_CONSTEXPR auto TurnPoint() const -> bool;
Q_DECL_CONSTEXPR auto CurvePoint() const -> bool;
constexpr auto TurnPoint() const -> bool;
constexpr auto CurvePoint() const -> bool;
Q_DECL_RELAXED_CONSTEXPR void SetTurnPoint(bool newTurnPoint);
Q_DECL_RELAXED_CONSTEXPR void SetCurvePoint(bool newCurvePoint);
constexpr void SetTurnPoint(bool newTurnPoint);
constexpr void SetCurvePoint(bool newCurvePoint);
auto toJson() const -> QJsonObject;
auto ToQPointF() const -> QPointF;
@ -104,37 +104,37 @@ auto operator>>(QDataStream &, VLayoutPoint &) -> QDataStream &;
#endif
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VLayoutPoint::VLayoutPoint(qreal xpos, qreal ypos)
constexpr VLayoutPoint::VLayoutPoint(qreal xpos, qreal ypos)
: QPointF(xpos, ypos)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VLayoutPoint::VLayoutPoint(QPointF p)
constexpr VLayoutPoint::VLayoutPoint(QPointF p)
: QPointF(p)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VLayoutPoint::TurnPoint() const -> bool
constexpr auto VLayoutPoint::TurnPoint() const -> bool
{
return m_turnPoint;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VLayoutPoint::SetTurnPoint(bool newTurnPoint)
constexpr void VLayoutPoint::SetTurnPoint(bool newTurnPoint)
{
m_turnPoint = newTurnPoint;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VLayoutPoint::CurvePoint() const -> bool
constexpr auto VLayoutPoint::CurvePoint() const -> bool
{
return m_curvePoint;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VLayoutPoint::SetCurvePoint(bool newCurvePoint)
constexpr void VLayoutPoint::SetCurvePoint(bool newCurvePoint)
{
m_curvePoint = newCurvePoint;
}

View File

@ -41,18 +41,18 @@ QT_WARNING_DISABLE_CLANG("-Wnon-virtual-dtor")
class VRawSAPoint final : public VLayoutPoint
{
public:
Q_DECL_CONSTEXPR VRawSAPoint() = default;
Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos);
Q_DECL_CONSTEXPR explicit VRawSAPoint(QPointF p);
Q_DECL_CONSTEXPR explicit VRawSAPoint(const VLayoutPoint &p);
Q_DECL_RELAXED_CONSTEXPR VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint);
Q_DECL_RELAXED_CONSTEXPR VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint, bool loopPoint);
constexpr VRawSAPoint() = default;
constexpr VRawSAPoint(qreal xpos, qreal ypos);
constexpr explicit VRawSAPoint(QPointF p);
constexpr explicit VRawSAPoint(const VLayoutPoint &p);
constexpr VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint);
constexpr VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint, bool loopPoint);
Q_DECL_CONSTEXPR auto LoopPoint() const -> bool;
Q_DECL_RELAXED_CONSTEXPR void SetLoopPoint(bool loopPoint);
constexpr auto LoopPoint() const -> bool;
constexpr void SetLoopPoint(bool loopPoint);
Q_DECL_CONSTEXPR auto Primary() const -> bool;
Q_DECL_RELAXED_CONSTEXPR void SetPrimary(bool primary);
constexpr auto Primary() const -> bool;
constexpr void SetPrimary(bool primary);
auto toJson() const -> QJsonObject;
@ -65,25 +65,25 @@ Q_DECLARE_METATYPE(VRawSAPoint) // NOLINT
Q_DECLARE_TYPEINFO(VRawSAPoint, Q_MOVABLE_TYPE); // NOLINT
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos)
constexpr VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos)
: VLayoutPoint(xpos, ypos)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p)
constexpr VRawSAPoint::VRawSAPoint(QPointF p)
: VLayoutPoint(p)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(const VLayoutPoint &p)
constexpr VRawSAPoint::VRawSAPoint(const VLayoutPoint &p)
: VLayoutPoint(p)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint)
constexpr VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint)
: VLayoutPoint(p)
{
SetCurvePoint(curvePoint);
@ -91,7 +91,7 @@ Q_DECL_RELAXED_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePo
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint, bool loopPoint)
constexpr VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint, bool loopPoint)
: VLayoutPoint(p),
m_loopPoint(loopPoint)
{
@ -100,25 +100,25 @@ Q_DECL_RELAXED_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePo
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VRawSAPoint::LoopPoint() const -> bool
constexpr auto VRawSAPoint::LoopPoint() const -> bool
{
return m_loopPoint;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VRawSAPoint::SetLoopPoint(bool loopPoint)
constexpr void VRawSAPoint::SetLoopPoint(bool loopPoint)
{
m_loopPoint = loopPoint;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VRawSAPoint::Primary() const -> bool
constexpr auto VRawSAPoint::Primary() const -> bool
{
return m_primary;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VRawSAPoint::SetPrimary(bool primary)
constexpr void VRawSAPoint::SetPrimary(bool primary)
{
m_primary = primary;
}

View File

@ -46,46 +46,46 @@ QT_WARNING_DISABLE_CLANG("-Wnon-virtual-dtor")
class VSAPoint final : public VLayoutPoint
{
public:
Q_DECL_CONSTEXPR VSAPoint() noexcept;
constexpr VSAPoint() noexcept;
Q_DECL_CONSTEXPR VSAPoint(qreal xpos, qreal ypos);
Q_DECL_CONSTEXPR explicit VSAPoint(QPointF p);
Q_DECL_CONSTEXPR explicit VSAPoint(const VLayoutPoint &p);
constexpr VSAPoint(qreal xpos, qreal ypos);
constexpr explicit VSAPoint(QPointF p);
constexpr explicit VSAPoint(const VLayoutPoint &p);
Q_DECL_CONSTEXPR auto GetSABefore() const -> qreal;
Q_DECL_CONSTEXPR auto GetSAAfter() const -> qreal;
constexpr auto GetSABefore() const -> qreal;
constexpr auto GetSAAfter() const -> qreal;
Q_DECL_CONSTEXPR auto GetAngleType() const -> PieceNodeAngle;
constexpr auto GetAngleType() const -> PieceNodeAngle;
Q_DECL_CONSTEXPR auto IsManualPasskmarkLength() const -> bool;
Q_DECL_CONSTEXPR auto IsManualPasskmarkWidth() const -> bool;
Q_DECL_CONSTEXPR auto IsManualPasskmarkAngle() const -> bool;
constexpr auto IsManualPasskmarkLength() const -> bool;
constexpr auto IsManualPasskmarkWidth() const -> bool;
constexpr auto IsManualPasskmarkAngle() const -> bool;
Q_DECL_CONSTEXPR auto GetPasskmarkLength() const -> qreal;
Q_DECL_CONSTEXPR auto GetPasskmarkWidth() const -> qreal;
Q_DECL_CONSTEXPR auto GetPasskmarkAngle() const -> qreal;
constexpr auto GetPasskmarkLength() const -> qreal;
constexpr auto GetPasskmarkWidth() const -> qreal;
constexpr auto GetPasskmarkAngle() const -> qreal;
Q_DECL_RELAXED_CONSTEXPR auto GetSABefore(qreal width) const -> qreal;
Q_DECL_RELAXED_CONSTEXPR auto GetSAAfter(qreal width) const -> qreal;
constexpr auto GetSABefore(qreal width) const -> qreal;
constexpr auto GetSAAfter(qreal width) const -> qreal;
Q_DECL_RELAXED_CONSTEXPR void SetSABefore(qreal value);
Q_DECL_RELAXED_CONSTEXPR void SetSAAfter(qreal value);
constexpr void SetSABefore(qreal value);
constexpr void SetSAAfter(qreal value);
Q_DECL_RELAXED_CONSTEXPR void SetAngleType(PieceNodeAngle value);
constexpr void SetAngleType(PieceNodeAngle value);
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkLength(bool value);
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkWidth(bool value);
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkAngle(bool value);
constexpr void SetManualPasskmarkLength(bool value);
constexpr void SetManualPasskmarkWidth(bool value);
constexpr void SetManualPasskmarkAngle(bool value);
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkLength(qreal value);
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkWidth(qreal value);
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkAngle(qreal value);
constexpr void SetPasskmarkLength(qreal value);
constexpr void SetPasskmarkWidth(qreal value);
constexpr void SetPasskmarkAngle(qreal value);
Q_DECL_RELAXED_CONSTEXPR auto MaxLocalSA(qreal width) const -> qreal;
Q_DECL_RELAXED_CONSTEXPR auto PassmarkLength(qreal width) const -> qreal;
constexpr auto MaxLocalSA(qreal width) const -> qreal;
constexpr auto PassmarkLength(qreal width) const -> qreal;
Q_DECL_CONSTEXPR auto IsPassmarkClockwiseOpening() const -> bool;
Q_DECL_RELAXED_CONSTEXPR void SetPassmarkClockwiseOpening(bool clockwise);
constexpr auto IsPassmarkClockwiseOpening() const -> bool;
constexpr void SetPassmarkClockwiseOpening(bool clockwise);
auto toJson() const -> QJsonObject;
@ -110,36 +110,36 @@ Q_DECLARE_METATYPE(VSAPoint) // NOLINT
Q_DECLARE_TYPEINFO(VSAPoint, Q_MOVABLE_TYPE); // NOLINT
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint() noexcept // NOLINT(hicpp-use-equals-default)
constexpr VSAPoint::VSAPoint() noexcept // NOLINT(hicpp-use-equals-default)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(qreal xpos, qreal ypos)
constexpr VSAPoint::VSAPoint(qreal xpos, qreal ypos)
: VLayoutPoint(xpos, ypos)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(QPointF p)
constexpr VSAPoint::VSAPoint(QPointF p)
: VLayoutPoint(p)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(const VLayoutPoint &p)
constexpr VSAPoint::VSAPoint(const VLayoutPoint &p)
: VLayoutPoint(p)
{
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::GetSABefore() const -> qreal
constexpr auto VSAPoint::GetSABefore() const -> qreal
{
return m_before;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::GetSABefore(qreal width) const -> qreal
constexpr auto VSAPoint::GetSABefore(qreal width) const -> qreal
{
if (m_before < 0)
{
@ -149,19 +149,19 @@ Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::GetSABefore(qreal width) const ->
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetSABefore(qreal value)
constexpr void VSAPoint::SetSABefore(qreal value)
{
value < 0 ? m_before = -1 : m_before = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::GetSAAfter() const -> qreal
constexpr auto VSAPoint::GetSAAfter() const -> qreal
{
return m_after;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::GetSAAfter(qreal width) const -> qreal
constexpr auto VSAPoint::GetSAAfter(qreal width) const -> qreal
{
if (m_after < 0)
{
@ -171,103 +171,103 @@ Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::GetSAAfter(qreal width) const ->
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetSAAfter(qreal value)
constexpr void VSAPoint::SetSAAfter(qreal value)
{
value < 0 ? m_after = -1 : m_after = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::GetAngleType() const -> PieceNodeAngle
constexpr auto VSAPoint::GetAngleType() const -> PieceNodeAngle
{
return m_angle;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetAngleType(PieceNodeAngle value)
constexpr void VSAPoint::SetAngleType(PieceNodeAngle value)
{
m_angle = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::IsManualPasskmarkLength() const -> bool
constexpr auto VSAPoint::IsManualPasskmarkLength() const -> bool
{
return m_manualPassmarkLength;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::IsManualPasskmarkWidth() const -> bool
constexpr auto VSAPoint::IsManualPasskmarkWidth() const -> bool
{
return m_manualPassmarkWidth;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::IsManualPasskmarkAngle() const -> bool
constexpr auto VSAPoint::IsManualPasskmarkAngle() const -> bool
{
return m_manualPassmarkAngle;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkLength(bool value)
constexpr void VSAPoint::SetManualPasskmarkLength(bool value)
{
m_manualPassmarkLength = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkWidth(bool value)
constexpr void VSAPoint::SetManualPasskmarkWidth(bool value)
{
m_manualPassmarkWidth = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkAngle(bool value)
constexpr void VSAPoint::SetManualPasskmarkAngle(bool value)
{
m_manualPassmarkAngle = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkLength() const -> qreal
constexpr auto VSAPoint::GetPasskmarkLength() const -> qreal
{
return m_passmarkLength;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkWidth() const -> qreal
constexpr auto VSAPoint::GetPasskmarkWidth() const -> qreal
{
return m_passmarkWidth;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkAngle() const -> qreal
constexpr auto VSAPoint::GetPasskmarkAngle() const -> qreal
{
return m_passmarkAngle;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkLength(qreal value)
constexpr void VSAPoint::SetPasskmarkLength(qreal value)
{
m_passmarkLength = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkWidth(qreal value)
constexpr void VSAPoint::SetPasskmarkWidth(qreal value)
{
m_passmarkWidth = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkAngle(qreal value)
constexpr void VSAPoint::SetPasskmarkAngle(qreal value)
{
m_passmarkAngle = value;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::MaxLocalSA(qreal width) const -> qreal
constexpr auto VSAPoint::MaxLocalSA(qreal width) const -> qreal
{
return qMax(GetSAAfter(width), GetSABefore(width));
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::PassmarkLength(qreal width) const -> qreal
constexpr auto VSAPoint::PassmarkLength(qreal width) const -> qreal
{
if (not m_manualPassmarkLength)
{
@ -280,13 +280,13 @@ Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::PassmarkLength(qreal width) const
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto VSAPoint::IsPassmarkClockwiseOpening() const -> bool
constexpr auto VSAPoint::IsPassmarkClockwiseOpening() const -> bool
{
return m_passmarkClockwiseOpening;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPassmarkClockwiseOpening(bool clockwise)
constexpr void VSAPoint::SetPassmarkClockwiseOpening(bool clockwise)
{
m_passmarkClockwiseOpening = clockwise;
}

View File

@ -67,13 +67,13 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wreserved-identifier")
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto operator""_L1(char ch)Q_DECL_NOEXCEPT->QLatin1Char
Q_DECL_CONSTEVAL inline auto operator""_L1(char ch)Q_DECL_NOEXCEPT->QLatin1Char
{
return QLatin1Char(ch);
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_CONSTEXPR inline auto operator""_L1(const char *str, size_t size)Q_DECL_NOEXCEPT->QLatin1String
Q_DECL_CONSTEVAL inline auto operator""_L1(const char *str, size_t size)Q_DECL_NOEXCEPT->QLatin1String
{
return QLatin1String(str, static_cast<vsizetype>(size));
}

View File

@ -471,25 +471,25 @@ auto QPixmapFromCache(const QString &pixmapPath) -> QPixmap;
void SetItemOverrideCursor(QGraphicsItem *item, const QString &pixmapPath, int hotX = -1, int hotY = -1);
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto MmToPixel(T val) noexcept -> T
template <typename T> constexpr auto MmToPixel(T val) noexcept -> T
{
return (val / 25.4) * PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto CmToPixel(T val) noexcept -> T
template <typename T> constexpr auto CmToPixel(T val) noexcept -> T
{
return ((val * 10.0) / 25.4) * PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto InchToPixel(T val) noexcept -> T
template <typename T> constexpr auto InchToPixel(T val) noexcept -> T
{
return val * PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) noexcept -> double
constexpr auto ToPixel(double val, const Unit &unit) noexcept -> double
{
switch (unit)
{
@ -508,25 +508,25 @@ Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) noexc
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto PixelToInch(T pix) -> T
template <typename T> constexpr auto PixelToInch(T pix) -> T
{
return pix / PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto PixelToMm(T pix) -> T
template <typename T> constexpr auto PixelToMm(T pix) -> T
{
return PixelToInch(pix) * 25.4;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto PixelToCm(T pix) -> T
template <typename T> constexpr auto PixelToCm(T pix) -> T
{
return PixelToInch(pix) * 2.54;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel(double pix, const Unit &unit) -> double
constexpr auto FromPixel(double pix, const Unit &unit) -> double
{
switch (unit)
{
@ -545,27 +545,27 @@ Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel(double pix, const Unit &unit) ->
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Inch2ToPixel2(T val) -> T
template <typename T> constexpr auto Inch2ToPixel2(T val) -> T
{
return val * (PrintDPI * PrintDPI);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Mm2ToPixel2(T val) -> T
template <typename T> constexpr auto Mm2ToPixel2(T val) -> T
{
// There are 0.15500031 square inches in a square centimeter.
return Inch2ToPixel2(val * 0.001550031);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Cm2ToPixel2(T val) -> T
template <typename T> constexpr auto Cm2ToPixel2(T val) -> T
{
// There are 0.15500031 square inches in a square centimeter.
return Inch2ToPixel2(val * 0.15500031);
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel2(double val, const Unit &unit) -> double
constexpr auto ToPixel2(double val, const Unit &unit) -> double
{
switch (unit)
{
@ -584,27 +584,27 @@ Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel2(double val, const Unit &unit) -> d
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Pixel2ToInch2(T pix) -> T
template <typename T> constexpr auto Pixel2ToInch2(T pix) -> T
{
return pix / (PrintDPI * PrintDPI);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Pixel2ToMm2(T pix) -> T
template <typename T> constexpr auto Pixel2ToMm2(T pix) -> T
{
// There are 0.15500031 square inches in a square centimeter.
return Pixel2ToInch2(pix) / 0.001550031;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Pixel2ToCm2(T pix) -> T
template <typename T> constexpr auto Pixel2ToCm2(T pix) -> T
{
// There are 0.15500031 square inches in a square centimeter.
return Pixel2ToInch2(pix) / 0.15500031;
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel2(double pix, const Unit &unit) -> double
constexpr auto FromPixel2(double pix, const Unit &unit) -> double
{
switch (unit)
{
@ -623,7 +623,7 @@ Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel2(double pix, const Unit &unit) ->
}
//---------------------------------------------------------------------------------------------------------------------
Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(qreal value, const Unit &from, const Unit &to) -> qreal
constexpr auto UnitConvertor(qreal value, const Unit &from, const Unit &to) -> qreal
{
switch (from)
{
@ -698,7 +698,7 @@ Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(qreal value, const Unit &from
* @brief UnitConvertor Converts the values of the given margin from given unit to the new unit.
* returns a new instand of QMarginsF.
*/
Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(const QMarginsF &margins, const Unit &from, const Unit &to)
constexpr auto UnitConvertor(const QMarginsF &margins, const Unit &from, const Unit &to)
-> QMarginsF
{
const qreal left = UnitConvertor(margins.left(), from, to);
@ -725,8 +725,8 @@ Q_REQUIRED_RESULT auto darkenPixmap(const QPixmap &pixmap) -> QPixmap;
void ShowInGraphicalShell(const QString &filePath);
Q_REQUIRED_RESULT Q_DECL_RELAXED_CONSTEXPR static inline auto VFuzzyComparePossibleNulls(double p1, double p2) -> bool;
Q_DECL_RELAXED_CONSTEXPR static inline auto VFuzzyComparePossibleNulls(double p1, double p2) -> bool
Q_REQUIRED_RESULT constexpr static inline auto VFuzzyComparePossibleNulls(double p1, double p2) -> bool;
constexpr static inline auto VFuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if (qFuzzyIsNull(p1))
{

View File

@ -59,4 +59,10 @@ class QTextCodec;
using VTextCodec = QTextCodec;
#endif
#if __cplusplus >= 202002L && defined(__cpp_consteval) && __cpp_consteval >= 201811L
#define Q_DECL_CONSTEVAL consteval
#else
#define Q_DECL_CONSTEVAL constexpr
#endif
#endif // DEFGLOBAL_H

View File

@ -37,12 +37,12 @@ constexpr unsigned DEBUG_VERSION = 52;
auto AppVersionStr() -> const QString &;
constexpr inline auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned
constexpr auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned
{
return ((major << 16u) | (minor << 8u) | patch);
}
constexpr inline auto AppVersion() -> unsigned
constexpr auto AppVersion() -> unsigned
{
return FormatVersion(MAJOR_VERSION, MINOR_VERSION, DEBUG_VERSION);
}

View File

@ -24,7 +24,7 @@
"PointColor": "#ffd900",
"NodeLabelColor": "#d9d9d9",
"NodeLabelHoverColor": "#ffd900",
"NodeLabelLineColor": "#80ffd900",
"NodeLabelLineColor": [255, 217, 0, 32],
"LabelBackgroundColor": "#80ffd900",
"LabelTextColor": "#d9d9d9",
"LabelModeColor": "white"

View File

@ -21,7 +21,7 @@
"PointColor": "black",
"NodeLabelColor": "black",
"NodeLabelHoverColor": "green",
"NodeLabelLineColor": [0, 0, 0],
"NodeLabelLineColor": [0, 0, 0, 16],
"LabelBackgroundColor": [251, 251, 175, 128],
"LabelTextColor": "black",
"LabelModeColor": "black"

View File

@ -70,7 +70,7 @@ using namespace Qt::Literals::StringLiterals;
namespace
{
Q_DECL_CONSTEXPR auto DAYS_TO_KEEP_LOGS = 3;
constexpr auto DAYS_TO_KEEP_LOGS = 3;
auto FilterLocales(const QStringList &locales) -> QStringList
{
@ -278,7 +278,7 @@ auto VAbstractApplication::QtTranslationsPath(const QString &locale) -> QString
#if defined(APPIMAGE)
Q_UNUSED(locale)
/* Fix path to translations when run inside AppImage. */
return AppImageRoot() + APPIMAGE_QT_TRANSLATIONS;
return AppImageRoot() + QLibraryPath(QLibraryInfo::TranslationsPath);
#else
return translationsPath(locale);
#endif // defined(APPIMAGE)
@ -371,7 +371,7 @@ void VAbstractApplication::LoadTranslation(QString locale)
LoadQM(qtTranslator, QStringLiteral("qt_"), locale, qtQmDir);
installTranslator(qtTranslator);
#if defined(Q_OS_WIN) && !defined(QBS_BUILD)
#if (defined(Q_OS_WIN) && !defined(QBS_BUILD)) || defined(APPIMAGE)
qtxmlTranslator = new QTranslator(this);
LoadQM(qtxmlTranslator, QStringLiteral("qtxmlpatterns_"), locale, qtQmDir);
installTranslator(qtxmlTranslator);
@ -570,7 +570,8 @@ void VAbstractApplication::CheckSystemLocale()
auto CheckLanguage = [](QStandardPaths::StandardLocation type, const QStringList &test)
{
const QString path = QStandardPaths::writableLocation(type);
return std::any_of(test.begin(), test.end(), [path](const QString &t) { return path.contains(t); });
bool const res = std::any_of(test.begin(), test.end(), [path](const QString &t) { return path.contains(t); });
return static_cast<int>(res);
};
int match = 0;

View File

@ -51,7 +51,7 @@
#define M_EULER (0.57721566490153286060)
#endif
template <typename T> Q_DECL_CONSTEXPR inline auto vRound(T d, int p) -> T
template <typename T> constexpr auto vRound(T d, int p) -> T
{ return p > 0 ? qRound(d * (p * 10.0)) / (p * 10.0) : qRound(d); }
#endif // VMATH_H

View File

@ -213,6 +213,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
if (skipFace == false)
{
QPolygonF face;
face.reserve(num_verts);
for (int ind = 0; ind < num_verts; ind++)
{
face << QPointF(pf[ind]);
@ -246,12 +247,6 @@ void VObjEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
*stream << Qt::endl;
}
//---------------------------------------------------------------------------------------------------------------------
void VObjEngine::drawPolygon(const QPoint *points, int pointCount, QPaintEngine::PolygonDrawMode mode)
{
QPaintEngine::drawPolygon(points, pointCount, mode);
}
//---------------------------------------------------------------------------------------------------------------------
auto VObjEngine::type() const -> QPaintEngine::Type
{
@ -273,12 +268,6 @@ void VObjEngine::drawPoints(const QPointF *points, int pointCount)
}
}
//---------------------------------------------------------------------------------------------------------------------
void VObjEngine::drawPoints(const QPoint *points, int pointCount)
{
QPaintEngine::drawPoints(points, pointCount);
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void VObjEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
@ -346,13 +335,16 @@ auto VObjEngine::MakePointsUnique(const QPolygonF &polygon) const -> QPolygonF
//---------------------------------------------------------------------------------------------------------------------
auto VObjEngine::Square(const QPolygonF &poly) const -> qint64
{
QVector<qreal> x;
QVector<qreal> y;
vsizetype const n = poly.count();
qreal s, res = 0;
qint64 sq = 0;
QVector<qreal> x;
QVector<qreal> y;
x.reserve(n);
y.reserve(n);
for (int i = 0; i < n; i++)
{
x.append(poly.at(i).x());

View File

@ -45,6 +45,9 @@ class QTextStream;
class VObjEngine final : public QPaintEngine
{
public:
using QPaintEngine::drawPoints;
using QPaintEngine::drawPolygon;
VObjEngine();
~VObjEngine() override = default;
@ -54,10 +57,8 @@ public:
virtual void drawPath(const QPainterPath &path) override;
virtual auto type() const -> Type override;
virtual void drawPoints(const QPointF *points, int pointCount) override;
virtual void drawPoints(const QPoint *points, int pointCount) override;
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
auto getSize() const -> QSize;
void setSize(const QSize &value);

View File

@ -44,7 +44,7 @@ namespace
auto PassmarkShapeToJson(const QVector<QLineF> &shape) -> QJsonArray
{
QJsonArray shapeArray;
for (auto line : shape)
for (const auto &line : shape)
{
QJsonObject const lineObject{
{"type", "QLineF"},

View File

@ -170,7 +170,7 @@ void VContainer::ClearNamespace(const QString &nspace)
* @return point
*/
// cppcheck-suppress unusedFunction
auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer<VGObject>
auto VContainer::GetGObject(quint32 id) const -> QSharedPointer<VGObject>
{
if (d->calculationObjects.contains(id))
{
@ -186,7 +186,7 @@ auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer<VGObject>
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::GetFakeGObject(quint32 id) -> const QSharedPointer<VGObject>
auto VContainer::GetFakeGObject(quint32 id) -> QSharedPointer<VGObject>
{
auto *obj = new VGObject();
obj->setId(id);
@ -575,13 +575,13 @@ void VContainer::FillPiecesAreas(Unit unit)
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataMeasurements() const -> const QMap<QString, QSharedPointer<VMeasurement>>
auto VContainer::DataMeasurements() const -> QMap<QString, QSharedPointer<VMeasurement>>
{
return DataVar<VMeasurement>(VarType::Measurement);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataMeasurementsWithSeparators() const -> const QMap<QString, QSharedPointer<VMeasurement>>
auto VContainer::DataMeasurementsWithSeparators() const -> QMap<QString, QSharedPointer<VMeasurement>>
{
QMap<QString, QSharedPointer<VMeasurement>> measurements = DataVar<VMeasurement>(VarType::Measurement);
QMap<QString, QSharedPointer<VMeasurement>> const separators = DataVar<VMeasurement>(VarType::MeasurementSeparator);
@ -592,13 +592,13 @@ auto VContainer::DataMeasurementsWithSeparators() const -> const QMap<QString, Q
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataIncrements() const -> const QMap<QString, QSharedPointer<VIncrement>>
auto VContainer::DataIncrements() const -> QMap<QString, QSharedPointer<VIncrement>>
{
return DataVar<VIncrement>(VarType::Increment);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataIncrementsWithSeparators() const -> const QMap<QString, QSharedPointer<VIncrement>>
auto VContainer::DataIncrementsWithSeparators() const -> QMap<QString, QSharedPointer<VIncrement>>
{
QMap<QString, QSharedPointer<VIncrement>> increments = DataVar<VIncrement>(VarType::Increment);
QMap<QString, QSharedPointer<VIncrement>> const separators = DataVar<VIncrement>(VarType::IncrementSeparator);
@ -609,43 +609,43 @@ auto VContainer::DataIncrementsWithSeparators() const -> const QMap<QString, QSh
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataLengthLines() const -> const QMap<QString, QSharedPointer<VLengthLine>>
auto VContainer::DataLengthLines() const -> QMap<QString, QSharedPointer<VLengthLine>>
{
return DataVar<VLengthLine>(VarType::LineLength);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataLengthCurves() const -> const QMap<QString, QSharedPointer<VCurveLength>>
auto VContainer::DataLengthCurves() const -> QMap<QString, QSharedPointer<VCurveLength>>
{
return DataVar<VCurveLength>(VarType::CurveLength);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataCurvesCLength() const -> const QMap<QString, QSharedPointer<VCurveCLength>>
auto VContainer::DataCurvesCLength() const -> QMap<QString, QSharedPointer<VCurveCLength>>
{
return DataVar<VCurveCLength>(VarType::CurveCLength);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataAngleLines() const -> const QMap<QString, QSharedPointer<VLineAngle>>
auto VContainer::DataAngleLines() const -> QMap<QString, QSharedPointer<VLineAngle>>
{
return DataVar<VLineAngle>(VarType::LineAngle);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataRadiusesArcs() const -> const QMap<QString, QSharedPointer<VArcRadius>>
auto VContainer::DataRadiusesArcs() const -> QMap<QString, QSharedPointer<VArcRadius>>
{
return DataVar<VArcRadius>(VarType::ArcRadius);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataAnglesCurves() const -> const QMap<QString, QSharedPointer<VCurveAngle>>
auto VContainer::DataAnglesCurves() const -> QMap<QString, QSharedPointer<VCurveAngle>>
{
return DataVar<VCurveAngle>(VarType::CurveAngle);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataPieceArea() const -> const QMap<QString, QSharedPointer<VPieceArea>>
auto VContainer::DataPieceArea() const -> QMap<QString, QSharedPointer<VPieceArea>>
{
QMap<QString, QSharedPointer<VPieceArea>> externalAreas = DataVar<VPieceArea>(VarType::PieceExternalArea);
QMap<QString, QSharedPointer<VPieceArea>> const seamLineAreas = DataVar<VPieceArea>(VarType::PieceSeamLineArea);
@ -708,7 +708,7 @@ auto VContainer::GetTrVars() const -> const VTranslateVars *
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> auto VContainer::DataVar(const VarType &type) const -> const QMap<QString, QSharedPointer<T>>
template <typename T> auto VContainer::DataVar(const VarType &type) const -> QMap<QString, QSharedPointer<T>>
{
QMap<QString, QSharedPointer<T>> map;
// Sorting QHash by id
@ -771,7 +771,7 @@ auto VContainer::CalculationGObjects() const -> const QHash<quint32, QSharedPoin
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataPieces() const -> const QHash<quint32, VPiece> *
auto VContainer::DataPieces() const -> QHash<quint32, VPiece> *
{
return d->pieces.data();
}

View File

@ -126,9 +126,9 @@ public:
static auto UniqueNamespace() -> QString;
template <typename T> auto GeometricObject(const quint32 &id) const -> const QSharedPointer<T>;
auto GetGObject(quint32 id) const -> const QSharedPointer<VGObject>;
static auto GetFakeGObject(quint32 id) -> const QSharedPointer<VGObject>;
template <typename T> auto GeometricObject(const quint32 &id) const -> QSharedPointer<T>;
auto GetGObject(quint32 id) const -> QSharedPointer<VGObject>;
static auto GetFakeGObject(quint32 id) -> QSharedPointer<VGObject>;
auto GetPiece(quint32 id) const -> VPiece;
auto GetPiecePath(quint32 id) const -> VPiecePath;
auto GetPieceForPiecePath(quint32 id) const -> quint32;
@ -178,20 +178,20 @@ public:
void FillPiecesAreas(Unit unit);
auto CalculationGObjects() const -> const QHash<quint32, QSharedPointer<VGObject>> *;
auto DataPieces() const -> const QHash<quint32, VPiece> *;
auto DataPieces() const -> QHash<quint32, VPiece> *;
auto DataVariables() const -> const QHash<QString, QSharedPointer<VInternalVariable>> *;
auto DataMeasurements() const -> const QMap<QString, QSharedPointer<VMeasurement>>;
auto DataMeasurementsWithSeparators() const -> const QMap<QString, QSharedPointer<VMeasurement>>;
auto DataIncrements() const -> const QMap<QString, QSharedPointer<VIncrement>>;
auto DataIncrementsWithSeparators() const -> const QMap<QString, QSharedPointer<VIncrement>>;
auto DataLengthLines() const -> const QMap<QString, QSharedPointer<VLengthLine>>;
auto DataLengthCurves() const -> const QMap<QString, QSharedPointer<VCurveLength>>;
auto DataCurvesCLength() const -> const QMap<QString, QSharedPointer<VCurveCLength>>;
auto DataAngleLines() const -> const QMap<QString, QSharedPointer<VLineAngle>>;
auto DataRadiusesArcs() const -> const QMap<QString, QSharedPointer<VArcRadius>>;
auto DataAnglesCurves() const -> const QMap<QString, QSharedPointer<VCurveAngle>>;
auto DataPieceArea() const -> const QMap<QString, QSharedPointer<VPieceArea>>;
auto DataMeasurements() const -> QMap<QString, QSharedPointer<VMeasurement>>;
auto DataMeasurementsWithSeparators() const -> QMap<QString, QSharedPointer<VMeasurement>>;
auto DataIncrements() const -> QMap<QString, QSharedPointer<VIncrement>>;
auto DataIncrementsWithSeparators() const -> QMap<QString, QSharedPointer<VIncrement>>;
auto DataLengthLines() const -> QMap<QString, QSharedPointer<VLengthLine>>;
auto DataLengthCurves() const -> QMap<QString, QSharedPointer<VCurveLength>>;
auto DataCurvesCLength() const -> QMap<QString, QSharedPointer<VCurveCLength>>;
auto DataAngleLines() const -> QMap<QString, QSharedPointer<VLineAngle>>;
auto DataRadiusesArcs() const -> QMap<QString, QSharedPointer<VArcRadius>>;
auto DataAnglesCurves() const -> QMap<QString, QSharedPointer<VCurveAngle>>;
auto DataPieceArea() const -> QMap<QString, QSharedPointer<VPieceArea>>;
auto IsUnique(const QString &name) const -> bool;
static auto IsUnique(const QString &name, const QString &nspace) -> bool;
@ -224,7 +224,7 @@ private:
template <typename T> void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
template <typename T> auto DataVar(const VarType &type) const -> const QMap<QString, QSharedPointer<T>>;
template <typename T> auto DataVar(const VarType &type) const -> QMap<QString, QSharedPointer<T>>;
static void ClearNamespace(const QString &nspace);
};
@ -236,7 +236,7 @@ Q_DECLARE_TYPEINFO(VContainer, Q_MOVABLE_TYPE); // NOLINT
*/
//---------------------------------------------------------------------------------------------------------------------
template <typename T> auto VContainer::GeometricObject(const quint32 &id) const -> const QSharedPointer<T>
template <typename T> auto VContainer::GeometricObject(const quint32 &id) const -> QSharedPointer<T>
{
if (id == NULL_ID)
{

View File

@ -31,6 +31,7 @@
#include <QSharedPointer>
#include <QString>
#include <QtGlobal>
#include <chrono>
#include "../vgeometry/vgeometrydef.h"
#include "../vmisc/typedef.h"
@ -50,7 +51,7 @@ class QListWidget;
class VPieceNode;
class QDialogButtonBox;
constexpr int formulaTimerTimeout = 300;
constexpr std::chrono::milliseconds formulaTimerTimeout = std::chrono::milliseconds(300);
extern const QColor errorColor;

View File

@ -284,25 +284,25 @@ void DialogCubicBezier::ValidateAlias()
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP1() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP1() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP1));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP2() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP2() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP2));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP3() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP3() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP3));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP4() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP4() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4));
}

View File

@ -91,10 +91,10 @@ private:
/** @brief number number of handled objects */
qint32 number{0};
auto GetP1() const -> const QSharedPointer<VPointF>;
auto GetP2() const -> const QSharedPointer<VPointF>;
auto GetP3() const -> const QSharedPointer<VPointF>;
auto GetP4() const -> const QSharedPointer<VPointF>;
auto GetP1() const -> QSharedPointer<VPointF>;
auto GetP2() const -> QSharedPointer<VPointF>;
auto GetP3() const -> QSharedPointer<VPointF>;
auto GetP4() const -> QSharedPointer<VPointF>;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -369,13 +369,13 @@ void DialogSpline::FXLength2()
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogSpline::GetP1() const -> const QSharedPointer<VPointF>
auto DialogSpline::GetP1() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP1));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogSpline::GetP4() const -> const QSharedPointer<VPointF>
auto DialogSpline::GetP4() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4));
}

View File

@ -130,8 +130,8 @@ private:
/** @brief number number of handled objects */
qint32 number{0};
auto GetP1() const -> const QSharedPointer<VPointF>;
auto GetP4() const -> const QSharedPointer<VPointF>;
auto GetP1() const -> QSharedPointer<VPointF>;
auto GetP4() const -> QSharedPointer<VPointF>;
auto CurrentSpline() const -> VSpline;

View File

@ -1997,7 +1997,7 @@ void DialogPiecePath::SetFormulaPassmarkWidth(const QString &formula)
//---------------------------------------------------------------------------------------------------------------------
auto DialogPiecePath::GetFormulaPassmarkAngle() const -> QString
{
QString const formula = ui->plainTextEditPassmarkWidth->toPlainText();
QString const formula = ui->plainTextEditPassmarkAngle->toPlainText();
return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}

View File

@ -257,9 +257,9 @@ void DialogPlaceLabel::ChosenObject(quint32 id, const SceneObject &type)
CheckPoint();
prepare = true;
timerWidth->setSingleShot(formulaTimerTimeout);
timerHeight->setSingleShot(formulaTimerTimeout);
timerAngle->setSingleShot(formulaTimerTimeout);
timerWidth->setSingleShot(formulaTimerTimeout.count());
timerHeight->setSingleShot(formulaTimerTimeout.count());
timerAngle->setSingleShot(formulaTimerTimeout.count());
this->setModal(true);
this->show();

View File

@ -42,13 +42,14 @@ auto InvalidImage() -> QPixmap
QImageReader imageReader(VBackgroundPatternImage::brokenImage);
return QPixmap::fromImageReader(&imageReader);
}
}
} // namespace
//---------------------------------------------------------------------------------------------------------------------
VBackgroundPixmapItem::VBackgroundPixmapItem(const VBackgroundPatternImage &image, VAbstractPattern *doc,
QGraphicsItem *parent)
: VBackgroundImageItem(image, doc, parent)
{}
: VBackgroundImageItem(image, doc, parent)
{
}
//---------------------------------------------------------------------------------------------------------------------
void VBackgroundPixmapItem::SetTransformationMode(Qt::TransformationMode mode)
@ -80,12 +81,6 @@ auto VBackgroundPixmapItem::shape() const -> QPainterPath
return Image().Matrix().map(m_shape);
}
//---------------------------------------------------------------------------------------------------------------------
auto VBackgroundPixmapItem::contains(const QPointF &point) const -> bool
{
return QGraphicsItem::contains(point);
}
//---------------------------------------------------------------------------------------------------------------------
void VBackgroundPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
@ -102,12 +97,6 @@ void VBackgroundPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsI
VBackgroundImageItem::paint(painter, option, widget);
}
//---------------------------------------------------------------------------------------------------------------------
auto VBackgroundPixmapItem::isObscuredBy(const QGraphicsItem *item) const -> bool
{
return QGraphicsItem::isObscuredBy(item);
}
//---------------------------------------------------------------------------------------------------------------------
auto VBackgroundPixmapItem::opaqueArea() const -> QPainterPath
{
@ -219,8 +208,7 @@ auto VBackgroundPixmapItem::Pixmap() const -> QPixmap
const double ratioX = PrintDPI / (image.dotsPerMeterX() / 100. * 2.54);
const double ratioY = PrintDPI / (image.dotsPerMeterY() / 100. * 2.54);
const QSize imageSize = image.size();
return image.scaled(qRound(imageSize.width()*ratioX),
qRound(imageSize.height()*ratioY),
return image.scaled(qRound(imageSize.width() * ratioX), qRound(imageSize.height() * ratioY),
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
};

View File

@ -52,11 +52,9 @@ public:
auto boundingRect() const -> QRectF override;
auto shape() const -> QPainterPath override;
auto contains(const QPointF &point) const -> bool override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
auto isObscuredBy(const QGraphicsItem *item) const -> bool override;
auto opaqueArea() const -> QPainterPath override;
auto GetShapeMode() const -> ShapeMode;

View File

@ -62,12 +62,6 @@ VToolCut::VToolCut(const VToolCutInitData &initData, QGraphicsItem *parent)
Q_ASSERT_X(initData.baseCurveId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCut::Disable(bool disable, const QString &namePP)
{
VToolSinglePoint::Disable(disable, namePP);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCut::SetDetailsMode(bool mode)
{

View File

@ -79,7 +79,6 @@ public:
auto CurveName() const -> QString;
public slots:
void Disable(bool disable, const QString &namePP) override;
void SetDetailsMode(bool mode) override;
void FullUpdateFromFile() override;

View File

@ -51,7 +51,7 @@ auto SourceToObjects(const QVector<SourceItem> &source) -> QVector<quint32>
QVector<quint32> ids;
ids.reserve(source.size());
for (auto s : source)
for (const auto &s : source)
{
ids.append(s.id);
}

View File

@ -247,7 +247,7 @@ void VAbstractTool::PerformDelete()
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractTool::Colors() -> const QStringList
auto VAbstractTool::Colors() -> QStringList
{
return QStringList{ColorBlack, ColorGreen, ColorBlue, ColorDarkRed, ColorDarkGreen,
ColorDarkBlue, ColorYellow, ColorLightSalmon, ColorGoldenRod, ColorOrange,

View File

@ -97,7 +97,7 @@ public:
static auto CheckFormula(const quint32 &toolId, QString &formula, VContainer *data) -> qreal;
static auto Colors() -> const QStringList;
static auto Colors() -> QStringList;
static auto ColorsList() -> QMap<QString, QString>;
static auto GetRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc) -> VToolRecord;

View File

@ -1213,7 +1213,6 @@ void VToolSeamAllowance::SaveRotationPattern(qreal dRot)
VPiece newDet = oldDet;
newDet.GetPatternLabelData().SetPos(m_patternInfo->pos());
newDet.GetPatternLabelData().SetFontSize(m_patternInfo->GetFontSize());
// Tranform angle to anticlockwise
QLineF line(0, 0, 100, 0);

View File

@ -82,10 +82,10 @@ VControlPointSpline::VControlPointSpline(const vsizetype &indexSpline, SplinePoi
{
Init();
this->setPos(controlPoint);
this->setFlag(QGraphicsItem::ItemIsMovable, true);
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
this->setAcceptHoverEvents(true);
this->setPos(controlPoint);
// Do not draw control point in constructor. It creates artefacts if they enabled from start.
}

View File

@ -0,0 +1,322 @@
{
"vector": [
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 2269.6800775571364,
"y": -661.873152
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1501.0464,
"y": -661.873152
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1501.0464,
"y": -661.873152
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1512.1145995857821,
"y": -659.2664997701993
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1532.8912663053902,
"y": -652.4991862709662
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1552.0904133319214,
"y": -643.9354106020951
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1569.7722176090087,
"y": -633.6511157390513
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1585.996856080286,
"y": -621.7222446573012
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1600.824505689387,
"y": -608.2247403323104
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1620.7340813635424,
"y": -585.3757687481523
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1642.729570732287,
"y": -549.8802763443196
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1660.2202896377282,
"y": -509.4772245259127
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1673.6876536289349,
"y": -464.7741570966591
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1683.6130782549744,
"y": -416.37861786028685
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1690.477979064915,
"y": -364.8981506205236
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1694.7637716078248,
"y": -310.9402991810972
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1697.5816751093885,
"y": -226.8072443045367
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1694.9984043727732,
"y": -53.22203976977377
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1693.0464,
"y": 58.126848
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1189.0464,
"y": 58.12684799999993
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 685.0464,
"y": 58.12684799999986
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 685.2339,
"y": 30.84559799999986
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 687.4135875,
"y": -26.107527000000132
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 694.2339,
"y": -115.12315200000012
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 709.9839,
"y": -236.62315200000012
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 731.9214,
"y": -354.7481520000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 751.89015,
"y": -436.5919020000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 766.4448375,
"y": -486.7950270000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 781.9135875,
"y": -532.3575270000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 798.155775,
"y": -572.4356520000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 815.030775,
"y": -606.1856520000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 832.3979625,
"y": -632.7637770000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 850.1167125,
"y": -651.3262770000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 863.5551890625,
"y": -659.1836988750001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 872.5464,
"y": -661.6622145000001
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 877.0464,
"y": -661.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 877.0464,
"y": -661.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 108.41272244286347,
"y": -661.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 108.41272244286347,
"y": -949.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1189.0464,
"y": -949.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 2269.6800775571364,
"y": -949.873152
}
]
}

View File

@ -0,0 +1,144 @@
{
"vector": [
{
"type": "QPointF",
"x": 2305.6800775571364,
"y": -625.873152
},
{
"type": "QPointF",
"x": 1633.1958258789232,
"y": -625.873152
},
{
"type": "QPointF",
"x": 1649.795721788633,
"y": -606.8224923501662
},
{
"type": "QPointF",
"x": 1674.7193149323566,
"y": -566.6017363452385
},
{
"type": "QPointF",
"x": 1694.087408271691,
"y": -521.8620042025294
},
{
"type": "QPointF",
"x": 1708.6267314176046,
"y": -473.6007154015538
},
{
"type": "QPointF",
"x": 1719.1312661189374,
"y": -422.3814839376958
},
{
"type": "QPointF",
"x": 1726.2889633615728,
"y": -368.7053116792325
},
{
"type": "QPointF",
"x": 1730.7160060188758,
"y": -312.9691304182097
},
{
"type": "QPointF",
"x": 1733.5906452137085,
"y": -227.14213989317568
},
{
"type": "QPointF",
"x": 1730.9944185791073,
"y": -52.68635212068391
},
{
"type": "QPointF",
"x": 1728.4208324505355,
"y": 94.126848
},
{
"type": "QPointF",
"x": 648.7981270798671,
"y": 94.12684799999985
},
{
"type": "QPointF",
"x": 649.2386325321073,
"y": 30.03330469904454
},
{
"type": "QPointF",
"x": 651.4662346184206,
"y": -28.171782072366085
},
{
"type": "QPointF",
"x": 658.4112351329172,
"y": -118.8147784780652
},
{
"type": "QPointF",
"x": 674.4092423831233,
"y": -242.22797726536976
},
{
"type": "QPointF",
"x": 696.7096815639468,
"y": -362.30726516211126
},
{
"type": "QPointF",
"x": 717.0990262409201,
"y": -445.8748609508329
},
{
"type": "QPointF",
"x": 732.0947750184293,
"y": -497.5993277486183
},
{
"type": "QPointF",
"x": 748.1588560513961,
"y": -544.9153482457203
},
{
"type": "QPointF",
"x": 765.3232534020617,
"y": -587.2690559941162
},
{
"type": "QPointF",
"x": 783.7592926518024,
"y": -624.1411344935976
},
{
"type": "QPointF",
"x": 784.8910607049277,
"y": -625.8731520000001
},
{
"type": "QPointF",
"x": 72.41272244286347,
"y": -625.8731520000001
},
{
"type": "QPointF",
"x": 72.41272244286347,
"y": -985.8731520000001
},
{
"type": "QPointF",
"x": 2305.6800775571364,
"y": -985.873152
},
{
"type": "QPointF",
"x": 2305.6800775571364,
"y": -625.873152
}
]
}

View File

@ -180,5 +180,7 @@
<file>full_path_case_3/input.json</file>
<file>full_path_case_4/output.json</file>
<file>full_path_case_4/input.json</file>
<file>25L_Knitting_Bag/input.json</file>
<file>25L_Knitting_Bag/output.json</file>
</qresource>
</RCC>

View File

@ -948,6 +948,10 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data()
ASSERT_TEST_CASE("Piece 2. CSA Exclude", QStringLiteral("://custom_seam_allwance_exclude_p2/input.json"),
QStringLiteral("://custom_seam_allwance_exclude_p2/output.json"),
37.795275590551185 /*seam allowance width 1 cm*/);
// See the file "valentina_private_collection/bugs/25L Knitting Bag.val"
ASSERT_TEST_CASE("Base", QStringLiteral("://25L_Knitting_Bag/input.json"),
QStringLiteral("://25L_Knitting_Bag/output.json"), 36 /*seam allowance width*/);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -35,8 +35,8 @@
#include <QtTest>
//---------------------------------------------------------------------------------------------------------------------
TST_VPoster::TST_VPoster(QObject *parent) :
QObject(parent)
TST_VPoster::TST_VPoster(QObject *parent)
: QObject(parent)
{
}
@ -45,12 +45,12 @@ TST_VPoster::TST_VPoster(QObject *parent) :
void TST_VPoster::BigPoster()
{
QPrinter printer;
printer.setResolution(static_cast<int>(PrintDPI));// By default
printer.setResolution(static_cast<int>(PrintDPI)); // By default
printer.setPageSize(QPageSize(QPageSize::A4));
printer.setFullPage(true);
// We need to set full page because otherwise QPrinter->pageRect returns different values in Windows and Linux
//sets the margins to 0 to perform the test.
// sets the margins to 0 to perform the test.
printer.setPageMargins(QMarginsF(), QPageLayout::Millimeter);
const QSize image(2622, 3178); // Little bit bigger than A1
@ -59,7 +59,7 @@ void TST_VPoster::BigPoster()
QCOMPARE(poster.size(), 12);
for (auto p : poster)
for (const auto &p : poster)
{
QCOMPARE(p.rect.size(), PageRect(printer).size());
}
@ -70,7 +70,7 @@ void TST_VPoster::BigPoster()
void TST_VPoster::SmallPoster()
{
QPrinter printer;
printer.setResolution(96);// By default
printer.setResolution(96); // By default
printer.setPageSize(QPageSize(QPageSize::A4));
const QSize image(700, 1000); // Little bit less than A4
@ -89,8 +89,8 @@ auto TST_VPoster::PageRect(const QPrinter &printer) const -> QRect
// we can't use method pageRect(QPrinter::Point). Our dpi different can be different.
// We convert value yourself to pixels.
const QRectF rect = printer.pageRect(QPrinter::Millimeter);
QRect pageRect(qFloor(ToPixel(rect.x())), qFloor(ToPixel(rect.y())),
qFloor(ToPixel(rect.width())), qFloor(ToPixel(rect.height())));
QRect pageRect(qFloor(ToPixel(rect.x())), qFloor(ToPixel(rect.y())), qFloor(ToPixel(rect.width())),
qFloor(ToPixel(rect.height())));
return pageRect;
}

View File

@ -902,7 +902,7 @@ void TST_VSpline::TestCutSpline()
VSpline spline1(spl.GetP1(), spl1p2, spl1p3, p);
spline1.SetApproximationScale(0.5);
Q_DECL_RELAXED_CONSTEXPR qreal eps = ToPixel(0.0001, Unit::Mm);
constexpr qreal eps = ToPixel(0.0001, Unit::Mm);
QVERIFY(UnitConvertor(spline1.GetLength(), Unit::Px, Unit::Cm) - result < eps);
}