Refactoring.
Fix code style.
This commit is contained in:
parent
1a0ca6c782
commit
e540c6292c
|
@ -28,32 +28,32 @@
|
||||||
|
|
||||||
#include "vpgraphicspiece.h"
|
#include "vpgraphicspiece.h"
|
||||||
|
|
||||||
#include <QPen>
|
|
||||||
#include <QBrush>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QGraphicsSceneMouseEvent>
|
|
||||||
#include <QStyleOptionGraphicsItem>
|
|
||||||
#include <QGraphicsSceneContextMenuEvent>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QtMath>
|
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QBrush>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QGraphicsSceneContextMenuEvent>
|
||||||
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPen>
|
||||||
|
#include <QStyleOptionGraphicsItem>
|
||||||
|
#include <QtMath>
|
||||||
|
|
||||||
#include "../layout/vppiece.h"
|
|
||||||
#include "../layout/vplayout.h"
|
#include "../layout/vplayout.h"
|
||||||
|
#include "../layout/vppiece.h"
|
||||||
#include "../layout/vpsheet.h"
|
#include "../layout/vpsheet.h"
|
||||||
#include "../vlayout/vtextmanager.h"
|
|
||||||
#include "../vlayout/vgraphicsfillitem.h"
|
#include "../vlayout/vgraphicsfillitem.h"
|
||||||
|
#include "../vlayout/vtextmanager.h"
|
||||||
|
|
||||||
#include "../vpapplication.h"
|
#include "../vpapplication.h"
|
||||||
|
|
||||||
#include "compatibility.h"
|
|
||||||
#include "../vlayout/vlayoutpiecepath.h"
|
#include "../vlayout/vlayoutpiecepath.h"
|
||||||
|
#include "compatibility.h"
|
||||||
|
|
||||||
#include "../vgeometry/vlayoutplacelabel.h"
|
#include "../vgeometry/vlayoutplacelabel.h"
|
||||||
|
|
||||||
#include "undocommands/vpundopiecemove.h"
|
|
||||||
#include "undocommands/vpundomovepieceonsheet.h"
|
#include "undocommands/vpundomovepieceonsheet.h"
|
||||||
|
#include "undocommands/vpundopiecemove.h"
|
||||||
#include "vpiecegrainline.h"
|
#include "vpiecegrainline.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
@ -110,7 +110,6 @@ inline auto LineFont(const TextLine& tl, const QFont &base) -> QFont
|
||||||
return fnt;
|
return fnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline auto LineText(const TextLine &tl, const QFontMetrics &fm, qreal width) -> QString
|
inline auto LineText(const TextLine &tl, const QFontMetrics &fm, qreal width) -> QString
|
||||||
{
|
{
|
||||||
|
@ -153,8 +152,8 @@ inline auto SelectionBrush() -> QBrush
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent) :
|
VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent)
|
||||||
QGraphicsObject(parent),
|
: QGraphicsObject(parent),
|
||||||
m_piece(piece)
|
m_piece(piece)
|
||||||
{
|
{
|
||||||
// set some infos
|
// set some infos
|
||||||
|
@ -267,8 +266,8 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (layout->LayoutSettings().GetStickyEdges() && m_hasStickyPosition)
|
if (layout->LayoutSettings().GetStickyEdges() && m_hasStickyPosition)
|
||||||
{
|
{
|
||||||
auto *command = new VPUndoPieceMove(piece, m_stickyTranslateX, m_stickyTranslateY,
|
auto *command =
|
||||||
m_allowChangeMerge);
|
new VPUndoPieceMove(piece, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge);
|
||||||
layout->UndoStack()->push(command);
|
layout->UndoStack()->push(command);
|
||||||
|
|
||||||
SetStickyPoints(QVector<QPointF>());
|
SetStickyPoints(QVector<QPointF>());
|
||||||
|
@ -825,4 +824,3 @@ auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &valu
|
||||||
|
|
||||||
return QGraphicsObject::itemChange(change, value);
|
return QGraphicsObject::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,23 +26,24 @@
|
||||||
**
|
**
|
||||||
** *************************************************************************/
|
** *************************************************************************/
|
||||||
|
|
||||||
#include <Qt>
|
|
||||||
#include <QFont>
|
|
||||||
#include <QXmlStreamAttributes>
|
|
||||||
#include <ciso646>
|
|
||||||
#include "vpiecegrainline.h"
|
|
||||||
#include "vplayoutfilereader.h"
|
#include "vplayoutfilereader.h"
|
||||||
#include "vplayoutliterals.h"
|
|
||||||
#include "../layout/vpsheet.h"
|
|
||||||
#include "../vlayout/vlayoutpiecepath.h"
|
|
||||||
#include "../vlayout/vtextmanager.h"
|
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||||
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
|
||||||
#include "../vgeometry/vlayoutplacelabel.h"
|
|
||||||
#include "../layout/vplayout.h"
|
#include "../layout/vplayout.h"
|
||||||
#include "../layout/vppiece.h"
|
#include "../layout/vppiece.h"
|
||||||
|
#include "../layout/vpsheet.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
#include "../vgeometry/vlayoutplacelabel.h"
|
||||||
|
#include "../vlayout/vlayoutpiecepath.h"
|
||||||
|
#include "../vlayout/vtextmanager.h"
|
||||||
|
#include "../vmisc/vcommonsettings.h"
|
||||||
|
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
||||||
|
#include "vpiecegrainline.h"
|
||||||
|
#include "vplayoutliterals.h"
|
||||||
|
#include <QFont>
|
||||||
|
#include <QXmlStreamAttributes>
|
||||||
|
#include <Qt>
|
||||||
|
#include <ciso646>
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||||
|
@ -238,8 +239,7 @@ void VPLayoutFileReader::ReadLayout(const VPLayoutPtr &layout)
|
||||||
{
|
{
|
||||||
AssertRootTag(ML::TagLayout);
|
AssertRootTag(ML::TagLayout);
|
||||||
|
|
||||||
const QStringList tags
|
const QStringList tags{
|
||||||
{
|
|
||||||
ML::TagProperties, // 0
|
ML::TagProperties, // 0
|
||||||
ML::TagUnplacedPieces, // 1
|
ML::TagUnplacedPieces, // 1
|
||||||
ML::TagSheets // 2
|
ML::TagSheets // 2
|
||||||
|
@ -271,8 +271,7 @@ void VPLayoutFileReader::ReadProperties(const VPLayoutPtr &layout)
|
||||||
{
|
{
|
||||||
AssertRootTag(ML::TagProperties);
|
AssertRootTag(ML::TagProperties);
|
||||||
|
|
||||||
const QStringList tags
|
const QStringList tags{
|
||||||
{
|
|
||||||
ML::TagUnit, // 0
|
ML::TagUnit, // 0
|
||||||
ML::TagTitle, // 1
|
ML::TagTitle, // 1
|
||||||
ML::TagDescription, // 2
|
ML::TagDescription, // 2
|
||||||
|
@ -359,8 +358,7 @@ void VPLayoutFileReader::ReadTiles(const VPLayoutPtr &layout)
|
||||||
layout->LayoutSettings().SetShowTileNumber(ReadAttributeBool(attribs, ML::AttrTileNumber, falseStr));
|
layout->LayoutSettings().SetShowTileNumber(ReadAttributeBool(attribs, ML::AttrTileNumber, falseStr));
|
||||||
// attribs.value(ML::AttrMatchingMarks); // TODO
|
// attribs.value(ML::AttrMatchingMarks); // TODO
|
||||||
|
|
||||||
const QStringList tags
|
const QStringList tags{
|
||||||
{
|
|
||||||
ML::TagSize, // 0
|
ML::TagSize, // 0
|
||||||
ML::TagMargin // 1
|
ML::TagMargin // 1
|
||||||
};
|
};
|
||||||
|
@ -426,8 +424,7 @@ void VPLayoutFileReader::ReadSheet(const VPLayoutPtr &layout)
|
||||||
QXmlStreamAttributes attribs = attributes();
|
QXmlStreamAttributes attribs = attributes();
|
||||||
sheet->SetGrainlineType(StrToGrainlineType(ReadAttributeEmptyString(attribs, ML::AttrGrainlineType)));
|
sheet->SetGrainlineType(StrToGrainlineType(ReadAttributeEmptyString(attribs, ML::AttrGrainlineType)));
|
||||||
|
|
||||||
const QStringList tags
|
const QStringList tags{
|
||||||
{
|
|
||||||
ML::TagName, // 0
|
ML::TagName, // 0
|
||||||
ML::TagSize, // 1
|
ML::TagSize, // 1
|
||||||
ML::TagMargin, // 2
|
ML::TagMargin, // 2
|
||||||
|
@ -462,7 +459,6 @@ void VPLayoutFileReader::ReadSheet(const VPLayoutPtr &layout)
|
||||||
layout->AddSheet(sheet);
|
layout->AddSheet(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPLayoutFileReader::ReadPieces(const VPLayoutPtr &layout, const VPSheetPtr &sheet)
|
void VPLayoutFileReader::ReadPieces(const VPLayoutPtr &layout, const VPSheetPtr &sheet)
|
||||||
{
|
{
|
||||||
|
@ -513,8 +509,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
|
||||||
piece->SetSewLineOnDrawing(ReadAttributeBool(attribs, ML::AttrSewLineOnDrawing, falseStr));
|
piece->SetSewLineOnDrawing(ReadAttributeBool(attribs, ML::AttrSewLineOnDrawing, falseStr));
|
||||||
piece->SetMatrix(StringToTransfrom(ReadAttributeEmptyString(attribs, ML::AttrTransform)));
|
piece->SetMatrix(StringToTransfrom(ReadAttributeEmptyString(attribs, ML::AttrTransform)));
|
||||||
|
|
||||||
const QStringList tags
|
const QStringList tags{
|
||||||
{
|
|
||||||
ML::TagSeamLine, // 0
|
ML::TagSeamLine, // 0
|
||||||
ML::TagSeamAllowance, // 1
|
ML::TagSeamAllowance, // 1
|
||||||
ML::TagGrainline, // 2
|
ML::TagGrainline, // 2
|
||||||
|
|
|
@ -27,19 +27,19 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "preferencespatternpage.h"
|
#include "preferencespatternpage.h"
|
||||||
#include "ui_preferencespatternpage.h"
|
|
||||||
#include "../dialogdatetimeformats.h"
|
#include "../dialogdatetimeformats.h"
|
||||||
#include "../dialogknownmaterials.h"
|
#include "../dialogknownmaterials.h"
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
|
#include "ui_preferencespatternpage.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vwidgets/vmaingraphicsview.h"
|
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
#include "../vwidgets/vmaingraphicsview.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -85,15 +85,16 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
||||||
ui->comboBoxLineWidthUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxLineWidthUnit->setCurrentIndex(indexUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
const Unit lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
|
const Unit lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
|
||||||
const qreal value = UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, lineUnit);
|
const qreal value = UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, lineUnit);
|
||||||
ui->doubleSpinBoxLineWidth->setDecimals(lineUnit == Unit::Mm ? 1 : 6);
|
ui->doubleSpinBoxLineWidth->setDecimals(lineUnit == Unit::Mm ? 1 : 6);
|
||||||
ui->doubleSpinBoxLineWidth->setMinimum(UnitConvertor(ui->doubleSpinBoxLineWidth->minimum(), m_oldLineUnit,
|
ui->doubleSpinBoxLineWidth->setMinimum(
|
||||||
lineUnit));
|
UnitConvertor(ui->doubleSpinBoxLineWidth->minimum(), m_oldLineUnit, lineUnit));
|
||||||
ui->doubleSpinBoxLineWidth->setMaximum(UnitConvertor(ui->doubleSpinBoxLineWidth->maximum(), m_oldLineUnit,
|
ui->doubleSpinBoxLineWidth->setMaximum(
|
||||||
lineUnit));
|
UnitConvertor(ui->doubleSpinBoxLineWidth->maximum(), m_oldLineUnit, lineUnit));
|
||||||
ui->doubleSpinBoxLineWidth->setValue(value);
|
ui->doubleSpinBoxLineWidth->setValue(value);
|
||||||
m_oldLineUnit = lineUnit;
|
m_oldLineUnit = lineUnit;
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#ifndef PREFERENCESPATTERNPAGE_H
|
#ifndef PREFERENCESPATTERNPAGE_H
|
||||||
#define PREFERENCESPATTERNPAGE_H
|
#define PREFERENCESPATTERNPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,72 +27,72 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vpattern.h"
|
#include "vpattern.h"
|
||||||
#include "../vwidgets/vabstractmainwindow.h"
|
#include "../core/vapplication.h"
|
||||||
#include "../vtools/tools/vdatatool.h"
|
|
||||||
#include "../vtools/tools/vtoolseamallowance.h"
|
|
||||||
#include "../vtools/tools/vtooluniondetails.h"
|
|
||||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
|
||||||
#include "../ifc/exception/vexceptionwrongid.h"
|
|
||||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||||
|
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||||
#include "../ifc/exception/vexceptionundo.h"
|
#include "../ifc/exception/vexceptionundo.h"
|
||||||
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../ifc/xml/vpatternconverter.h"
|
#include "../ifc/xml/vpatternconverter.h"
|
||||||
#include "../vmisc/customevents.h"
|
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
|
||||||
#include "../vmisc/projectversion.h"
|
|
||||||
#include "../vmisc/compatibility.h"
|
|
||||||
#include "../vmisc/vsysexits.h"
|
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
#include "../qmuparser/qmutokenparser.h"
|
#include "../qmuparser/qmutokenparser.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
#include "../vgeometry/vellipticalarc.h"
|
|
||||||
#include "../vgeometry/vsplinepath.h"
|
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
#include "../vgeometry/vcubicbezierpath.h"
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
|
#include "../vmisc/compatibility.h"
|
||||||
|
#include "../vmisc/customevents.h"
|
||||||
|
#include "../vmisc/projectversion.h"
|
||||||
|
#include "../vmisc/vsysexits.h"
|
||||||
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
|
||||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
|
||||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||||
#include "../vpatterndb/vpiecepath.h"
|
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||||
#include "../vpatterndb/vnodedetail.h"
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
#include "../vpatterndb/variables/vincrement.h"
|
#include "../vpatterndb/variables/vincrement.h"
|
||||||
|
#include "../vpatterndb/vnodedetail.h"
|
||||||
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
|
#include "../vpatterndb/vpiecepath.h"
|
||||||
|
#include "../vtools/tools/vdatatool.h"
|
||||||
|
#include "../vtools/tools/vtoolseamallowance.h"
|
||||||
|
#include "../vtools/tools/vtooluniondetails.h"
|
||||||
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h"
|
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h"
|
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h"
|
#include "../vtools/tools/drawTools/operation/vtoolmove.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h"
|
#include "../vtools/tools/drawTools/operation/vtoolrotation.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolarc.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolarc.h"
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h"
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolspline.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h"
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolsplinepath.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h"
|
||||||
#include "../vtools/tools/drawTools/vtoolline.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolcurve/vtoolspline.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolcurve/vtoolsplinepath.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
#include "../vtools/tools/drawTools/vtoolline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/vtoolrotation.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/vtoolmove.h"
|
|
||||||
|
|
||||||
#include "../vtools/tools/nodeDetails/vnodearc.h"
|
#include "../vtools/tools/nodeDetails/vnodearc.h"
|
||||||
#include "../vtools/tools/nodeDetails/vnodeellipticalarc.h"
|
#include "../vtools/tools/nodeDetails/vnodeellipticalarc.h"
|
||||||
|
@ -109,17 +109,17 @@
|
||||||
#include <QScopeGuard>
|
#include <QScopeGuard>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QUndoStack>
|
|
||||||
#include <QtNumeric>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QtConcurrentMap>
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrentRun>
|
#include <QMessageBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <functional>
|
#include <QUndoStack>
|
||||||
|
#include <QtConcurrentMap>
|
||||||
|
#include <QtConcurrentRun>
|
||||||
|
#include <QtNumeric>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||||
// DO NOT WORK WITH GCC 4.8
|
// DO NOT WORK WITH GCC 4.8
|
||||||
|
@ -140,8 +140,7 @@ namespace
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto FileComment() -> QString
|
auto FileComment() -> QString
|
||||||
{
|
{
|
||||||
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).")
|
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR);
|
||||||
.arg(APP_VERSION_STR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -164,7 +163,10 @@ auto DefLabelLanguage() -> QString
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPattern::VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, QObject *parent)
|
VPattern::VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, QObject *parent)
|
||||||
: VAbstractPattern(parent), data(data), sceneDraw(sceneDraw), sceneDetail(sceneDetail)
|
: VAbstractPattern(parent),
|
||||||
|
data(data),
|
||||||
|
sceneDraw(sceneDraw),
|
||||||
|
sceneDetail(sceneDetail)
|
||||||
{
|
{
|
||||||
SCASSERT(sceneDraw != nullptr)
|
SCASSERT(sceneDraw != nullptr)
|
||||||
SCASSERT(sceneDetail != nullptr)
|
SCASSERT(sceneDetail != nullptr)
|
||||||
|
@ -182,8 +184,8 @@ void VPattern::CreateEmptyFile()
|
||||||
|
|
||||||
patternElement.appendChild(createComment(FileComment()));
|
patternElement.appendChild(createComment(FileComment()));
|
||||||
patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr));
|
patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr));
|
||||||
patternElement.appendChild(CreateElementWithText(TagUnit,
|
patternElement.appendChild(
|
||||||
UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
|
CreateElementWithText(TagUnit, UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
|
||||||
|
|
||||||
patternElement.appendChild(createElement(TagDescription));
|
patternElement.appendChild(createElement(TagDescription));
|
||||||
patternElement.appendChild(createElement(TagNotes));
|
patternElement.appendChild(createElement(TagNotes));
|
||||||
|
@ -193,8 +195,8 @@ void VPattern::CreateEmptyFile()
|
||||||
patternElement.appendChild(createElement(TagPreviewCalculations));
|
patternElement.appendChild(createElement(TagPreviewCalculations));
|
||||||
|
|
||||||
this->appendChild(patternElement);
|
this->appendChild(patternElement);
|
||||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
insertBefore(
|
||||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
||||||
this->firstChild());
|
this->firstChild());
|
||||||
|
|
||||||
// Cache values
|
// Cache values
|
||||||
|
@ -455,8 +457,8 @@ auto VPattern::SaveDocument(const QString &fileName, QString &error) -> bool
|
||||||
}
|
}
|
||||||
catch (const VExceptionWrongId &e)
|
catch (const VExceptionWrongId &e)
|
||||||
{
|
{
|
||||||
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error not unique id.")),
|
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error not unique id.")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,15 +543,15 @@ void VPattern::LiteParseIncrements()
|
||||||
}
|
}
|
||||||
catch (const VExceptionWrongId &e)
|
catch (const VExceptionWrongId &e)
|
||||||
{
|
{
|
||||||
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")),
|
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
emit SetEnabledGUI(false);
|
emit SetEnabledGUI(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (VException &e)
|
catch (VException &e)
|
||||||
{
|
{
|
||||||
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
|
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
emit SetEnabledGUI(false);
|
emit SetEnabledGUI(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -567,9 +569,7 @@ auto VPattern::ElementsToParse() const -> int
|
||||||
QVector<QString> tags{TagCalculation, TagDetails, TagModeling, TagIncrements};
|
QVector<QString> tags{TagCalculation, TagDetails, TagModeling, TagIncrements};
|
||||||
|
|
||||||
std::function<int(const QString &tagName)> TagsCount = [this](const QString &tagName)
|
std::function<int(const QString &tagName)> TagsCount = [this](const QString &tagName)
|
||||||
{
|
{ return elementsByTagName(tagName).length(); };
|
||||||
return elementsByTagName(tagName).length();
|
|
||||||
};
|
|
||||||
|
|
||||||
return QtConcurrent::blockingMappedReduced(tags, TagsCount, GatherCount);
|
return QtConcurrent::blockingMappedReduced(tags, TagsCount, GatherCount);
|
||||||
}
|
}
|
||||||
|
@ -645,8 +645,8 @@ void VPattern::LiteParseTree(const Document &parse)
|
||||||
}
|
}
|
||||||
catch (const VExceptionWrongId &e)
|
catch (const VExceptionWrongId &e)
|
||||||
{
|
{
|
||||||
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")),
|
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
emit SetEnabledGUI(false);
|
emit SetEnabledGUI(false);
|
||||||
if (not VApplication::IsGUIMode())
|
if (not VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
|
@ -656,8 +656,8 @@ void VPattern::LiteParseTree(const Document &parse)
|
||||||
}
|
}
|
||||||
catch (VException &e)
|
catch (VException &e)
|
||||||
{
|
{
|
||||||
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
|
qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
emit SetEnabledGUI(false);
|
emit SetEnabledGUI(false);
|
||||||
if (not VApplication::IsGUIMode())
|
if (not VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
|
@ -946,26 +946,25 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
||||||
initData.detail.SetUUID(GetParametrEmptyString(domElement, AttrUUID));
|
initData.detail.SetUUID(GetParametrEmptyString(domElement, AttrUUID));
|
||||||
initData.detail.SetShortName(GetParametrEmptyString(domElement, AttrShortName).left(25));
|
initData.detail.SetShortName(GetParametrEmptyString(domElement, AttrShortName).left(25));
|
||||||
initData.detail.SetGradationLabel(GetParametrEmptyString(domElement, AttrGradationLabel));
|
initData.detail.SetGradationLabel(GetParametrEmptyString(domElement, AttrGradationLabel));
|
||||||
initData.detail.SetMx(VAbstractValApplication::VApp()
|
initData.detail.SetMx(
|
||||||
->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
|
||||||
initData.detail.SetMy(VAbstractValApplication::VApp()
|
initData.detail.SetMy(
|
||||||
->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
|
||||||
initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
|
initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
|
||||||
initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
|
initData.detail.SetHideMainPath(
|
||||||
QString().setNum(VAbstractValApplication::VApp()
|
GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
|
||||||
->ValentinaSettings()->IsHideMainPath())));
|
QString().setNum(VAbstractValApplication::VApp()->ValentinaSettings()->IsHideMainPath())));
|
||||||
initData.detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement,
|
initData.detail.SetSeamAllowanceBuiltIn(
|
||||||
VToolSeamAllowance::AttrSeamAllowanceBuiltIn,
|
GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowanceBuiltIn, falseStr));
|
||||||
falseStr));
|
initData.detail.SetForbidFlipping(GetParametrBool(
|
||||||
initData.detail.SetForbidFlipping(GetParametrBool(domElement, AttrForbidFlipping,
|
domElement, AttrForbidFlipping,
|
||||||
QString().setNum(VAbstractValApplication::VApp()
|
QString().setNum(VAbstractValApplication::VApp()->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
||||||
->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
initData.detail.SetForceFlipping(GetParametrBool(
|
||||||
initData.detail.SetForceFlipping(GetParametrBool(domElement, AttrForceFlipping,
|
domElement, AttrForceFlipping,
|
||||||
QString().setNum(VAbstractValApplication::VApp()
|
QString().setNum(VAbstractValApplication::VApp()->ValentinaSettings()->GetForceWorkpieceFlipping())));
|
||||||
->ValentinaSettings()->GetForceWorkpieceFlipping())));
|
initData.detail.SetSewLineOnDrawing(GetParametrBool(
|
||||||
initData.detail.SetSewLineOnDrawing(GetParametrBool(domElement, AttrSewLineOnDrawing,
|
domElement, AttrSewLineOnDrawing,
|
||||||
QString().setNum(VAbstractValApplication::VApp()
|
QString().setNum(VAbstractValApplication::VApp()->ValentinaSettings()->GetSewLineOnDrawing())));
|
||||||
->ValentinaSettings()->GetSewLineOnDrawing())));
|
|
||||||
initData.detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
initData.detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||||
initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr));
|
initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr));
|
||||||
initData.detail.SetPriority(GetParametrUInt(domElement, VToolSeamAllowance::AttrPiecePriority, QChar('0')));
|
initData.detail.SetPriority(GetParametrUInt(domElement, VToolSeamAllowance::AttrPiecePriority, QChar('0')));
|
||||||
|
@ -1007,14 +1006,9 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
|
||||||
{
|
{
|
||||||
const uint version = GetParametrUInt(domElement, AttrVersion, QChar('1'));
|
const uint version = GetParametrUInt(domElement, AttrVersion, QChar('1'));
|
||||||
|
|
||||||
const QStringList tags = QStringList() << TagNodes
|
const QStringList tags = QStringList() << TagNodes << TagData << TagPatternInfo << TagGrainline
|
||||||
<< TagData
|
<< VToolSeamAllowance::TagCSA << VToolSeamAllowance::TagIPaths
|
||||||
<< TagPatternInfo
|
<< VToolSeamAllowance::TagPins << VToolSeamAllowance::TagPlaceLabels;
|
||||||
<< TagGrainline
|
|
||||||
<< VToolSeamAllowance::TagCSA
|
|
||||||
<< VToolSeamAllowance::TagIPaths
|
|
||||||
<< VToolSeamAllowance::TagPins
|
|
||||||
<< VToolSeamAllowance::TagPlaceLabels;
|
|
||||||
|
|
||||||
QFuture<QVector<VPieceNode>> futurePathV1;
|
QFuture<QVector<VPieceNode>> futurePathV1;
|
||||||
QFuture<VPiecePath> futurePathV2;
|
QFuture<VPiecePath> futurePathV2;
|
||||||
|
@ -1040,7 +1034,8 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
|
||||||
// TODO. Delete if minimal supported version is 0.4.0
|
// TODO. Delete if minimal supported version is 0.4.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0),
|
||||||
"Time to refactor the code.");
|
"Time to refactor the code.");
|
||||||
futurePathV1 = QtConcurrent::run([this, domElement, element]()
|
futurePathV1 = QtConcurrent::run(
|
||||||
|
[this, domElement, element]()
|
||||||
{
|
{
|
||||||
const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1'));
|
const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1'));
|
||||||
const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0"));
|
const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0"));
|
||||||
|
@ -1053,22 +1048,18 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // TagData
|
case 1: // TagData
|
||||||
futurePPData = QtConcurrent::run([this, element, detail]()
|
futurePPData = QtConcurrent::run(
|
||||||
{
|
[this, element, detail]() { return ParsePieceDataTag(element, detail.GetPieceLabelData()); });
|
||||||
return ParsePieceDataTag(element, detail.GetPieceLabelData());
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 2: // TagPatternInfo
|
case 2: // TagPatternInfo
|
||||||
futurePatternInfo = QtConcurrent::run([this, element, detail]()
|
futurePatternInfo =
|
||||||
{
|
QtConcurrent::run([this, element, detail]()
|
||||||
return ParsePiecePatternInfo(element, detail.GetPatternLabelData());
|
{ return ParsePiecePatternInfo(element, detail.GetPatternLabelData()); });
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 3: // TagGrainline
|
case 3: // TagGrainline
|
||||||
futureGGeometry = QtConcurrent::run([this, element, detail]()
|
futureGGeometry =
|
||||||
{
|
QtConcurrent::run([this, element, detail]()
|
||||||
return ParsePieceGrainline(element, detail.GetGrainlineGeometry());
|
{ return ParsePieceGrainline(element, detail.GetGrainlineGeometry()); });
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 4: // VToolSeamAllowance::TagCSA
|
case 4: // VToolSeamAllowance::TagCSA
|
||||||
futureRecords = QtConcurrent::run(&VPattern::ParsePieceCSARecords, element);
|
futureRecords = QtConcurrent::run(&VPattern::ParsePieceCSARecords, element);
|
||||||
|
@ -1141,8 +1132,8 @@ auto VPattern::ParseDetailNodes(const QDomElement &domElement, qreal width, bool
|
||||||
for (qint32 i = 0; i < nodeList.size(); ++i)
|
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||||
{
|
{
|
||||||
const QDomElement element = nodeList.at(i).toElement();
|
const QDomElement element = nodeList.at(i).toElement();
|
||||||
if (not element.isNull()
|
if (not element.isNull() &&
|
||||||
&& element.tagName() == VAbstractPattern::TagNode) // Old detail version need this check!
|
element.tagName() == VAbstractPattern::TagNode) // Old detail version need this check!
|
||||||
{
|
{
|
||||||
oldNodes.append(ParseDetailNode(element));
|
oldNodes.append(ParseDetailNode(element));
|
||||||
}
|
}
|
||||||
|
@ -1163,8 +1154,8 @@ auto VPattern::ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData
|
||||||
ppData.SetFoldPosition(GetParametrEmptyString(domElement, AttrFoldPosition));
|
ppData.SetFoldPosition(GetParametrEmptyString(domElement, AttrFoldPosition));
|
||||||
ppData.SetQuantity(static_cast<quint16>(GetParametrUInt(domElement, AttrQuantity, QChar('1'))));
|
ppData.SetQuantity(static_cast<quint16>(GetParametrUInt(domElement, AttrQuantity, QChar('1'))));
|
||||||
ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr));
|
ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr));
|
||||||
ppData.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
ppData.SetPos(
|
||||||
GetParametrDouble(domElement, AttrMy, QChar('0'))));
|
QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')), GetParametrDouble(domElement, AttrMy, QChar('0'))));
|
||||||
ppData.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, QChar('0'))));
|
ppData.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, QChar('0'))));
|
||||||
ppData.SetRotation(GetParametrString(domElement, AttrRotation, QChar('0')));
|
ppData.SetRotation(GetParametrString(domElement, AttrRotation, QChar('0')));
|
||||||
|
|
||||||
|
@ -1197,8 +1188,8 @@ auto VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabe
|
||||||
-> VPatternLabelData
|
-> VPatternLabelData
|
||||||
{
|
{
|
||||||
patternInfo.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
patternInfo.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
||||||
patternInfo.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
patternInfo.SetPos(
|
||||||
GetParametrDouble(domElement, AttrMy, QChar('0'))));
|
QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')), GetParametrDouble(domElement, AttrMy, QChar('0'))));
|
||||||
patternInfo.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, QChar('0'))));
|
patternInfo.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, QChar('0'))));
|
||||||
patternInfo.SetRotation(GetParametrString(domElement, AttrRotation, QChar('0')));
|
patternInfo.SetRotation(GetParametrString(domElement, AttrRotation, QChar('0')));
|
||||||
|
|
||||||
|
@ -1229,8 +1220,8 @@ auto VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabe
|
||||||
auto VPattern::ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const -> VGrainlineData
|
auto VPattern::ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const -> VGrainlineData
|
||||||
{
|
{
|
||||||
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
|
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
|
||||||
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
gGeometry.SetPos(
|
||||||
GetParametrDouble(domElement, AttrMy, QChar('0'))));
|
QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')), GetParametrDouble(domElement, AttrMy, QChar('0'))));
|
||||||
gGeometry.SetArrowType(static_cast<GrainlineArrowDirection>(GetParametrUInt(domElement, AttrArrows, QChar('0'))));
|
gGeometry.SetArrowType(static_cast<GrainlineArrowDirection>(GetParametrUInt(domElement, AttrArrows, QChar('0'))));
|
||||||
|
|
||||||
const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR);
|
const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR);
|
||||||
|
@ -1453,8 +1444,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
* @param domElement tag in xml tree.
|
* @param domElement tag in xml tree.
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
*/
|
*/
|
||||||
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
const Document &parse)
|
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -1589,10 +1579,10 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
|
||||||
initData.typeCreation = Source::FromFile;
|
initData.typeCreation = Source::FromFile;
|
||||||
|
|
||||||
PointsCommonAttributes(domElement, initData);
|
PointsCommonAttributes(domElement, initData);
|
||||||
initData.x = VAbstractValApplication::VApp()
|
initData.x =
|
||||||
->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
|
||||||
initData.y = VAbstractValApplication::VApp()
|
initData.y =
|
||||||
->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
|
||||||
|
|
||||||
spoint = VToolBasePoint::Create(initData);
|
spoint = VToolBasePoint::Create(initData);
|
||||||
}
|
}
|
||||||
|
@ -1987,7 +1977,8 @@ void VPattern::ParsePinPoint(const QDomElement &domElement, const Document &pars
|
||||||
catch (const VExceptionBadId &)
|
catch (const VExceptionBadId &)
|
||||||
{ // Possible case. Parent was deleted, but the node object is still here.
|
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||||
qDebug() << "Broken relation. Parent was deleted, but the place label object is still here. Place label "
|
qDebug() << "Broken relation. Parent was deleted, but the place label object is still here. Place label "
|
||||||
"id =" << initData.id << ".";
|
"id ="
|
||||||
|
<< initData.id << ".";
|
||||||
return; // Just ignore
|
return; // Just ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2025,7 +2016,8 @@ void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse)
|
||||||
catch (const VExceptionBadId &)
|
catch (const VExceptionBadId &)
|
||||||
{ // Possible case. Parent was deleted, but the node object is still here.
|
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||||
qDebug() << "Broken relation. Parent was deleted, but the place label object is still here. Place label "
|
qDebug() << "Broken relation. Parent was deleted, but the place label object is still here. Place label "
|
||||||
"id =" << initData.id << ".";
|
"id ="
|
||||||
|
<< initData.id << ".";
|
||||||
return; // Just ignore
|
return; // Just ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2040,8 +2032,8 @@ void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse)
|
||||||
initData.angle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0"));
|
initData.angle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0"));
|
||||||
const QString angle = initData.angle; // need for saving fixed formula;
|
const QString angle = initData.angle; // need for saving fixed formula;
|
||||||
|
|
||||||
initData.visibilityTrigger = GetParametrString(domElement, VAbstractPattern::AttrVisible,
|
initData.visibilityTrigger =
|
||||||
QStringLiteral("1.0"));
|
GetParametrString(domElement, VAbstractPattern::AttrVisible, QStringLiteral("1.0"));
|
||||||
const QString visibility = initData.visibilityTrigger; // need for saving fixed formula;
|
const QString visibility = initData.visibilityTrigger; // need for saving fixed formula;
|
||||||
|
|
||||||
initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0')));
|
initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0')));
|
||||||
|
@ -2049,8 +2041,8 @@ void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse)
|
||||||
VToolPlaceLabel::Create(initData);
|
VToolPlaceLabel::Create(initData);
|
||||||
|
|
||||||
// Rewrite attribute formula. Need for situation when we have wrong formula.
|
// Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (w != initData.width || h != initData.height || angle != initData.angle
|
if (w != initData.width || h != initData.height || angle != initData.angle ||
|
||||||
|| visibility != initData.visibilityTrigger)
|
visibility != initData.visibilityTrigger)
|
||||||
{
|
{
|
||||||
SetAttribute(domElement, AttrWidth, initData.width);
|
SetAttribute(domElement, AttrWidth, initData.width);
|
||||||
SetAttribute(domElement, AttrHeight, initData.height);
|
SetAttribute(domElement, AttrHeight, initData.height);
|
||||||
|
@ -2301,8 +2293,7 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement,
|
void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
const Document &parse)
|
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -2336,23 +2327,20 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of intersection line and axis"),
|
VExceptionObjectError excep(tr("Error creating or updating point of intersection line and axis"), domElement);
|
||||||
domElement);
|
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of intersection line and axis"),
|
VExceptionObjectError excep(tr("Error creating or updating point of intersection line and axis"), domElement);
|
||||||
domElement);
|
|
||||||
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
|
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement,
|
void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
|
||||||
const Document &parse)
|
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -2392,15 +2380,13 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of intersection curve and axis"),
|
VExceptionObjectError excep(tr("Error creating or updating point of intersection curve and axis"), domElement);
|
||||||
domElement);
|
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating point of intersection curve and axis"),
|
VExceptionObjectError excep(tr("Error creating or updating point of intersection curve and axis"), domElement);
|
||||||
domElement);
|
|
||||||
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
|
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
|
@ -2620,17 +2606,17 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
|
||||||
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
|
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
|
||||||
|
|
||||||
initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
|
initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
|
||||||
initData.mx1 = VAbstractValApplication::VApp()
|
initData.mx1 =
|
||||||
->toPixel(GetParametrDouble(domElement, AttrMx1, QString::number(labelMX)));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx1, QString::number(labelMX)));
|
||||||
initData.my1 = VAbstractValApplication::VApp()
|
initData.my1 =
|
||||||
->toPixel(GetParametrDouble(domElement, AttrMy1, QString::number(labelMY)));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMy1, QString::number(labelMY)));
|
||||||
initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr);
|
initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr);
|
||||||
|
|
||||||
initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
|
initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
|
||||||
initData.mx2 = VAbstractValApplication::VApp()
|
initData.mx2 =
|
||||||
->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
|
||||||
initData.my2 = VAbstractValApplication::VApp()
|
initData.my2 =
|
||||||
->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
|
VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
|
||||||
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
|
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
|
||||||
|
|
||||||
VToolTrueDarts::Create(initData);
|
VToolTrueDarts::Create(initData);
|
||||||
|
@ -3232,8 +3218,8 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do
|
||||||
|
|
||||||
VToolEllipticalArc::Create(initData);
|
VToolEllipticalArc::Create(initData);
|
||||||
// Rewrite attribute formula. Need for situation when we have wrong formula.
|
// Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (r1 != initData.radius1 || r2 != initData.radius2 || f1Fix != initData.f1 || f2Fix != initData.f2
|
if (r1 != initData.radius1 || r2 != initData.radius2 || f1Fix != initData.f1 || f2Fix != initData.f2 ||
|
||||||
|| frotationFix != initData.rotationAngle)
|
frotationFix != initData.rotationAngle)
|
||||||
{
|
{
|
||||||
SetAttribute(domElement, AttrRadius1, initData.radius1);
|
SetAttribute(domElement, AttrRadius1, initData.radius1);
|
||||||
SetAttribute(domElement, AttrRadius2, initData.radius2);
|
SetAttribute(domElement, AttrRadius2, initData.radius2);
|
||||||
|
@ -3646,7 +3632,8 @@ void VPattern::GarbageCollector(bool commit)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vidtype id = GetParametrId(modNode);
|
vidtype id = GetParametrId(modNode);
|
||||||
auto record = std::find_if(history.begin(), history.end(),
|
auto record =
|
||||||
|
std::find_if(history.begin(), history.end(),
|
||||||
[id](const VToolRecord &record) { return record.getId() == id; });
|
[id](const VToolRecord &record) { return record.getId() == id; });
|
||||||
if (record != history.end())
|
if (record != history.end())
|
||||||
{
|
{
|
||||||
|
@ -3796,7 +3783,8 @@ auto VPattern::PPLastToolId(const QString &name) const -> quint32
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::RefreshPieceGeometry()
|
void VPattern::RefreshPieceGeometry()
|
||||||
{
|
{
|
||||||
auto CleanRefreshList = qScopeGuard([this]()
|
auto CleanRefreshList = qScopeGuard(
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
updatePieces.clear();
|
updatePieces.clear();
|
||||||
VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
|
VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
|
||||||
|
@ -3845,8 +3833,8 @@ void VPattern::RefreshPieceGeometry()
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
* @param type type of spline.
|
* @param type type of spline.
|
||||||
*/
|
*/
|
||||||
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
const Document &parse, const QString &type)
|
const QString &type)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -3976,8 +3964,8 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
* @param type type of spline.
|
* @param type type of spline.
|
||||||
*/
|
*/
|
||||||
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse,
|
||||||
const Document &parse, const QString &type)
|
const QString &type)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -4081,7 +4069,8 @@ void VPattern::ParsePathElement(VMainGraphicsScene *scene, QDomElement &domEleme
|
||||||
catch (const VExceptionBadId &)
|
catch (const VExceptionBadId &)
|
||||||
{ // Possible case. Parent was deleted, but the node object is still here.
|
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||||
qDebug() << "Broken relation. Parent was deleted, but the piece path object is still here. Piece "
|
qDebug() << "Broken relation. Parent was deleted, but the piece path object is still here. Piece "
|
||||||
"path id =" << initData.id << ".";
|
"path id ="
|
||||||
|
<< initData.id << ".";
|
||||||
return; // Just ignore
|
return; // Just ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4136,10 +4125,11 @@ void VPattern::ParseIncrementsElement(const QDomNode &node, const Document &pars
|
||||||
{
|
{
|
||||||
const QString name = GetParametrString(domElement, AttrName, QString()).simplified();
|
const QString name = GetParametrString(domElement, AttrName, QString()).simplified();
|
||||||
const QString desc = GetParametrEmptyString(domElement, AttrDescription);
|
const QString desc = GetParametrEmptyString(domElement, AttrDescription);
|
||||||
const IncrementType type = StringToIncrementType(GetParametrString(domElement, AttrType,
|
const IncrementType type =
|
||||||
strTypeIncrement));
|
StringToIncrementType(GetParametrString(domElement, AttrType, strTypeIncrement));
|
||||||
const QString formula = (type == IncrementType::Separator) ?
|
const QString formula = (type == IncrementType::Separator)
|
||||||
QChar('0') : GetParametrString(domElement, AttrFormula, QChar('0'));
|
? QChar('0')
|
||||||
|
: GetParametrString(domElement, AttrFormula, QChar('0'));
|
||||||
const bool specialUnits = GetParametrBool(domElement, AttrSpecialUnits, falseStr);
|
const bool specialUnits = GetParametrBool(domElement, AttrSpecialUnits, falseStr);
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -4260,7 +4250,8 @@ void VPattern::SetIncrementSpecialUnits(const QString &name, bool special)
|
||||||
QDomElement node = FindIncrement(name);
|
QDomElement node = FindIncrement(name);
|
||||||
if (not node.isNull())
|
if (not node.isNull())
|
||||||
{
|
{
|
||||||
SetAttributeOrRemoveIf<bool>(node, AttrSpecialUnits, special, [](bool special) noexcept {return not special;});
|
SetAttributeOrRemoveIf<bool>(node, AttrSpecialUnits, special,
|
||||||
|
[](bool special) noexcept { return not special; });
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4283,10 +4274,9 @@ void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const Q
|
||||||
// Eval formula
|
// Eval formula
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(expressions.at(i).expression, false,
|
QScopedPointer<qmu::QmuTokenParser> cal(
|
||||||
false));
|
new qmu::QmuTokenParser(expressions.at(i).expression, false, false));
|
||||||
tokens = cal->GetTokens(); // Tokens (variables, measurements)
|
tokens = cal->GetTokens(); // Tokens (variables, measurements)
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (const qmu::QmuParserError &)
|
catch (const qmu::QmuParserError &)
|
||||||
{
|
{
|
||||||
|
@ -4491,14 +4481,9 @@ void VPattern::PrepareForParse(const Document &parse)
|
||||||
else if (parse == Document::LiteParse || parse == Document::FullLiteParse)
|
else if (parse == Document::LiteParse || parse == Document::FullLiteParse)
|
||||||
{
|
{
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 12, "Check that you used all types");
|
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 12, "Check that you used all types");
|
||||||
QVector<VarType> types{VarType::LineAngle,
|
QVector<VarType> types{VarType::LineAngle, VarType::LineLength, VarType::CurveLength,
|
||||||
VarType::LineLength,
|
VarType::CurveCLength, VarType::ArcRadius, VarType::CurveAngle,
|
||||||
VarType::CurveLength,
|
VarType::PieceExternalArea, VarType::PieceSeamLineArea};
|
||||||
VarType::CurveCLength,
|
|
||||||
VarType::ArcRadius,
|
|
||||||
VarType::CurveAngle,
|
|
||||||
VarType::PieceExternalArea,
|
|
||||||
VarType::PieceSeamLineArea};
|
|
||||||
if (parse == Document::FullLiteParse)
|
if (parse == Document::FullLiteParse)
|
||||||
{
|
{
|
||||||
types.append(VarType::Increment);
|
types.append(VarType::Increment);
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
|
||||||
#include <QGraphicsPathItem>
|
#include <QGraphicsPathItem>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMessageLogger>
|
#include <QMessageLogger>
|
||||||
|
@ -41,9 +40,10 @@
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QPolygonF>
|
#include <QPolygonF>
|
||||||
#include <QTransform>
|
#include <QTransform>
|
||||||
#include <Qt>
|
|
||||||
#include <QtDebug>
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <Qt>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
#include <QtDebug>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
#include "../vgeometry/vlayoutplacelabel.h"
|
#include "../vgeometry/vlayoutplacelabel.h"
|
||||||
|
@ -122,8 +122,8 @@ auto FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
|
||||||
const auto topLeftPinPoint = pattern->GeometricObject<VPointF>(topLeftPin);
|
const auto topLeftPinPoint = pattern->GeometricObject<VPointF>(topLeftPin);
|
||||||
const auto bottomRightPinPoint = pattern->GeometricObject<VPointF>(bottomRightPin);
|
const auto bottomRightPinPoint = pattern->GeometricObject<VPointF>(bottomRightPin);
|
||||||
|
|
||||||
const QRectF labelRect = QRectF(static_cast<QPointF>(*topLeftPinPoint),
|
const QRectF labelRect =
|
||||||
static_cast<QPointF>(*bottomRightPinPoint));
|
QRectF(static_cast<QPointF>(*topLeftPinPoint), static_cast<QPointF>(*bottomRightPinPoint));
|
||||||
labelWidth = qAbs(labelRect.width());
|
labelWidth = qAbs(labelRect.width());
|
||||||
labelHeight = qAbs(labelRect.height());
|
labelHeight = qAbs(labelRect.height());
|
||||||
|
|
||||||
|
@ -232,75 +232,7 @@ auto ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern) -> QVect
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark,
|
auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark, PassmarkSide side,
|
||||||
PassmarkSide side, bool &ok) -> VLayoutPassmark
|
|
||||||
{
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
|
||||||
// noexcept-expression evaluates to 'false' because of a call to 'constexpr QPointF::QPointF()'
|
|
||||||
|
|
||||||
VLayoutPassmark layoutPassmark;
|
|
||||||
|
|
||||||
QT_WARNING_POP
|
|
||||||
|
|
||||||
VPiecePassmarkData pData = passmark.Data();
|
|
||||||
const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
|
|
||||||
const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
|
|
||||||
if (nodeIndex == -1)
|
|
||||||
{
|
|
||||||
const QString errorMsg =
|
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
|
||||||
.arg(pData.nodeName, piece.GetName());
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
ok = false;
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<QLineF> baseLines = passmark.SAPassmarkBaseLine(piece, pattern, static_cast<PassmarkSide>(side));
|
|
||||||
if (baseLines.isEmpty())
|
|
||||||
{
|
|
||||||
const QString errorMsg =
|
|
||||||
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
|
|
||||||
.arg(pData.nodeName, piece.GetName());
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
ok = false;
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
|
||||||
{
|
|
||||||
layoutPassmark.baseLine = ConstFirst(baseLines);
|
|
||||||
}
|
|
||||||
else if (side == PassmarkSide::Right)
|
|
||||||
{
|
|
||||||
layoutPassmark.baseLine = ConstLast(baseLines);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QVector<QLineF> lines = passmark.SAPassmark(piece, pattern, side);
|
|
||||||
if (lines.isEmpty())
|
|
||||||
{
|
|
||||||
const QString errorMsg =
|
|
||||||
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
|
|
||||||
.arg(pData.nodeName, piece.GetName());
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
ok = false;
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutPassmark.lines = lines;
|
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
|
||||||
layoutPassmark.isBuiltIn = false;
|
|
||||||
layoutPassmark.isClockwiseOpening = pData.passmarkSAPoint.IsPassmarkClockwiseOpening();
|
|
||||||
|
|
||||||
ok = true;
|
|
||||||
return layoutPassmark;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark,
|
|
||||||
bool &ok) -> VLayoutPassmark
|
bool &ok) -> VLayoutPassmark
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
|
@ -317,10 +249,79 @@ auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, co
|
||||||
if (nodeIndex == -1)
|
if (nodeIndex == -1)
|
||||||
{
|
{
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.").arg(pData.nodeName, piece.GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<QLineF> baseLines = passmark.SAPassmarkBaseLine(piece, pattern, static_cast<PassmarkSide>(side));
|
||||||
|
if (baseLines.isEmpty())
|
||||||
|
{
|
||||||
|
const QString errorMsg =
|
||||||
|
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (side == PassmarkSide::All || side == PassmarkSide::Right)
|
||||||
|
{
|
||||||
|
layoutPassmark.baseLine = ConstFirst(baseLines);
|
||||||
|
}
|
||||||
|
else if (side == PassmarkSide::Right)
|
||||||
|
{
|
||||||
|
layoutPassmark.baseLine = ConstLast(baseLines);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<QLineF> lines = passmark.SAPassmark(piece, pattern, side);
|
||||||
|
if (lines.isEmpty())
|
||||||
|
{
|
||||||
|
const QString errorMsg = QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
|
||||||
|
.arg(pData.nodeName, piece.GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
ok = false;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutPassmark.lines = lines;
|
||||||
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
|
layoutPassmark.isBuiltIn = false;
|
||||||
|
layoutPassmark.isClockwiseOpening = pData.passmarkSAPoint.IsPassmarkClockwiseOpening();
|
||||||
|
|
||||||
|
ok = true;
|
||||||
|
return layoutPassmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, const VPassmark &passmark, bool &ok)
|
||||||
|
-> VLayoutPassmark
|
||||||
|
{
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
||||||
|
// noexcept-expression evaluates to 'false' because of a call to 'constexpr QPointF::QPointF()'
|
||||||
|
|
||||||
|
VLayoutPassmark layoutPassmark;
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
VPiecePassmarkData pData = passmark.Data();
|
||||||
|
const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
|
||||||
|
const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
|
||||||
|
if (nodeIndex == -1)
|
||||||
|
{
|
||||||
|
const QString errorMsg =
|
||||||
|
QObject::tr("Passmark '%1' is not part of piece '%2'.").arg(pData.nodeName, piece.GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
ok = false;
|
ok = false;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -328,11 +329,11 @@ auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, co
|
||||||
const QVector<QLineF> lines = passmark.BuiltInSAPassmark(piece, pattern);
|
const QVector<QLineF> lines = passmark.BuiltInSAPassmark(piece, pattern);
|
||||||
if (lines.isEmpty())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
const QString errorMsg =
|
const QString errorMsg = QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
||||||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
ok = false;
|
ok = false;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -346,8 +347,9 @@ auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, co
|
||||||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
|
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
|
||||||
"empty.")
|
"empty.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
ok = false;
|
ok = false;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -426,17 +428,14 @@ auto ConvertPassmarks(const VPiece &piece, const VContainer *pattern) -> QVector
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
|
if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark() &&
|
||||||
&& (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() ||
|
(VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath()) &&
|
||||||
not piece.IsHideMainPath())
|
pData.isMainPathNode && pData.passmarkAngleType != PassmarkAngleType::Intersection &&
|
||||||
&& pData.isMainPathNode
|
pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft &&
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::Intersection
|
pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyRight &&
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
|
pData.passmarkAngleType != PassmarkAngleType::Intersection2 &&
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyRight
|
pData.passmarkAngleType != PassmarkAngleType::Intersection2OnlyLeft &&
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::Intersection2
|
pData.passmarkAngleType != PassmarkAngleType::Intersection2OnlyRight && pData.isShowSecondPassmark)
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::Intersection2OnlyLeft
|
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::Intersection2OnlyRight
|
|
||||||
&& pData.isShowSecondPassmark)
|
|
||||||
{
|
{
|
||||||
AddBuiltInPassmark();
|
AddBuiltInPassmark();
|
||||||
}
|
}
|
||||||
|
@ -587,12 +586,15 @@ auto operator>>(QDataStream &dataStream, VLayoutPiece &piece) -> QDataStream &
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::VLayoutPiece()
|
VLayoutPiece::VLayoutPiece()
|
||||||
: d(new VLayoutPieceData)
|
: d(new VLayoutPieceData)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail) // NOLINT(modernize-use-equals-default)
|
VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail) // NOLINT(modernize-use-equals-default)
|
||||||
:VAbstractPiece(detail), d(detail.d)
|
: VAbstractPiece(detail),
|
||||||
{}
|
d(detail.d)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
|
auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
|
||||||
|
@ -608,9 +610,10 @@ auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
|
||||||
|
|
||||||
#ifdef Q_COMPILER_RVALUE_REFS
|
#ifdef Q_COMPILER_RVALUE_REFS
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW
|
VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW : VAbstractPiece(std::move(detail)),
|
||||||
:VAbstractPiece(std::move(detail)), d(std::move(detail.d))
|
d(std::move(detail.d))
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW->VLayoutPiece &
|
auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW->VLayoutPiece &
|
||||||
|
@ -623,7 +626,8 @@ auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW -> VLayoutPie
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::~VLayoutPiece() // NOLINT(modernize-use-equals-default)
|
VLayoutPiece::~VLayoutPiece() // NOLINT(modernize-use-equals-default)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece
|
auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece
|
||||||
|
@ -655,14 +659,14 @@ auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pat
|
||||||
|
|
||||||
if (not futureSeamAllowanceValid.result())
|
if (not futureSeamAllowanceValid.result())
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.").arg(piece.GetName());
|
||||||
.arg(piece.GetName());
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
? throw VException(errorMsg)
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
det.SetContourPoints(futureMainPath.result(),
|
det.SetContourPoints(futureMainPath.result(), VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath()
|
||||||
VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() ? false
|
? false
|
||||||
: piece.IsHideMainPath());
|
: piece.IsHideMainPath());
|
||||||
det.SetSeamAllowancePoints(futureSeamAllowance.result(), piece.IsSeamAllowance(), piece.IsSeamAllowanceBuiltIn());
|
det.SetSeamAllowancePoints(futureSeamAllowance.result(), piece.IsSeamAllowance(), piece.IsSeamAllowanceBuiltIn());
|
||||||
det.SetInternalPaths(futureInternalPaths.result());
|
det.SetInternalPaths(futureInternalPaths.result());
|
||||||
|
@ -713,8 +717,7 @@ auto VLayoutPiece::GetUniqueID() const -> QString
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <class T>
|
template <class T> auto VLayoutPiece::Map(QVector<T> points) const -> QVector<T>
|
||||||
auto VLayoutPiece::Map(QVector<T> points) const -> QVector<T>
|
|
||||||
{
|
{
|
||||||
std::transform(points.begin(), points.end(), points.begin(),
|
std::transform(points.begin(), points.end(), points.begin(),
|
||||||
[this](const T &point) { return d->m_matrix.map(point); });
|
[this](const T &point) { return d->m_matrix.map(point); });
|
||||||
|
@ -739,10 +742,10 @@ auto VLayoutPiece::Map<VLayoutPassmark>(QVector<VLayoutPassmark> passmarks) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <>
|
template <> auto VLayoutPiece::Map<VLayoutPoint>(QVector<VLayoutPoint> points) const -> QVector<VLayoutPoint>
|
||||||
auto VLayoutPiece::Map<VLayoutPoint>(QVector<VLayoutPoint> points) const -> QVector<VLayoutPoint>
|
|
||||||
{
|
{
|
||||||
std::transform(points.begin(), points.end(), points.begin(), [this](VLayoutPoint point)
|
std::transform(points.begin(), points.end(), points.begin(),
|
||||||
|
[this](VLayoutPoint point)
|
||||||
{
|
{
|
||||||
auto p = static_cast<QPointF>(point); // NOLINT(cppcoreguidelines-slicing)
|
auto p = static_cast<QPointF>(point); // NOLINT(cppcoreguidelines-slicing)
|
||||||
p = d->m_matrix.map(p);
|
p = d->m_matrix.map(p);
|
||||||
|
@ -866,11 +869,9 @@ void VLayoutPiece::SetPieceText(const QString& qsName, const VPieceLabelData& da
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QPointF> v;
|
QVector<QPointF> v{ptPos, QPointF(ptPos.x() + labelWidth, ptPos.y()),
|
||||||
v << ptPos
|
QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight),
|
||||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y())
|
QPointF(ptPos.x(), ptPos.y() + labelHeight)};
|
||||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight)
|
|
||||||
<< QPointF(ptPos.x(), ptPos.y() + labelHeight);
|
|
||||||
|
|
||||||
const qreal dAng = qDegreesToRadians(-labelAngle);
|
const qreal dAng = qDegreesToRadians(-labelAngle);
|
||||||
const QPointF ptCenter(ptPos.x() + labelWidth / 2, ptPos.y() + labelHeight / 2);
|
const QPointF ptCenter(ptPos.x() + labelWidth / 2, ptPos.y() + labelHeight / 2);
|
||||||
|
@ -946,11 +947,9 @@ void VLayoutPiece::SetPatternInfo(VAbstractPattern* pDoc, const VPatternLabelDat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QPointF> v;
|
QVector<QPointF> v{ptPos, QPointF(ptPos.x() + labelWidth, ptPos.y()),
|
||||||
v << ptPos
|
QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight),
|
||||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y())
|
QPointF(ptPos.x(), ptPos.y() + labelHeight)};
|
||||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight)
|
|
||||||
<< QPointF(ptPos.x(), ptPos.y() + labelHeight);
|
|
||||||
|
|
||||||
const qreal dAng = qDegreesToRadians(-labelAngle);
|
const qreal dAng = qDegreesToRadians(-labelAngle);
|
||||||
const QPointF ptCenter(ptPos.x() + labelWidth / 2, ptPos.y() + labelHeight / 2);
|
const QPointF ptCenter(ptPos.x() + labelWidth / 2, ptPos.y() + labelHeight / 2);
|
||||||
|
@ -1291,15 +1290,14 @@ void VLayoutPiece::SetLayoutAllowancePoints()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::GetMappedExternalContourPoints() const -> QVector<VLayoutPoint>
|
auto VLayoutPiece::GetMappedExternalContourPoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetMappedSeamAllowancePoints() :
|
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetMappedSeamAllowancePoints()
|
||||||
GetMappedContourPoints();
|
: GetMappedContourPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::GetExternalContourPoints() const -> QVector<VLayoutPoint>
|
auto VLayoutPiece::GetExternalContourPoints() const -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetSeamAllowancePoints() :
|
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? GetSeamAllowancePoints() : GetContourPoints();
|
||||||
GetContourPoints();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1490,8 +1488,8 @@ auto VLayoutPiece::GetItem(bool textAsPaths) const -> QGraphicsItem *
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::IsLayoutAllowanceValid() const -> bool
|
auto VLayoutPiece::IsLayoutAllowanceValid() const -> bool
|
||||||
{
|
{
|
||||||
QVector<VLayoutPoint> base = (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) ?
|
QVector<VLayoutPoint> base =
|
||||||
d->m_seamAllowance : d->m_contour;
|
(IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) ? d->m_seamAllowance : d->m_contour;
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
CastTo(base, points);
|
CastTo(base, points);
|
||||||
return VAbstractPiece::IsAllowanceValid(points, d->m_layoutAllowance);
|
return VAbstractPiece::IsAllowanceValid(points, d->m_layoutAllowance);
|
||||||
|
@ -1519,7 +1517,6 @@ auto VLayoutPiece::BiggestEdge() const -> qreal
|
||||||
return edge;
|
return edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutPiece::MapPlaceLabelShape(PlaceLabelImg shape) const -> PlaceLabelImg
|
auto VLayoutPiece::MapPlaceLabelShape(PlaceLabelImg shape) const -> PlaceLabelImg
|
||||||
{
|
{
|
||||||
|
@ -1556,8 +1553,8 @@ auto VLayoutPiece::GrainlinePath(const GrainlineShape &shape) -> QPainterPath
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape,
|
void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
||||||
const VTextManager &tm, bool textAsPaths) const
|
bool textAsPaths) const
|
||||||
{
|
{
|
||||||
SCASSERT(parent != nullptr)
|
SCASSERT(parent != nullptr)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ const quint16 VTextManager::classVersion = 1;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC(QVector<TextLine>, m_patternLabelLines) // NOLINT
|
Q_GLOBAL_STATIC(QVector<TextLine>, m_patternLabelLinesCache) // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friend functions
|
// Friend functions
|
||||||
|
@ -644,10 +644,10 @@ void VTextManager::Update(VAbstractPattern *pDoc, const VContainer *pattern)
|
||||||
{
|
{
|
||||||
m_liLines.clear();
|
m_liLines.clear();
|
||||||
|
|
||||||
if (m_patternLabelLines->isEmpty() || pDoc->GetPatternWasChanged())
|
if (m_patternLabelLinesCache->isEmpty() || pDoc->GetPatternWasChanged())
|
||||||
{
|
{
|
||||||
QVector<VLabelTemplateLine> lines = pDoc->GetPatternLabelTemplate();
|
QVector<VLabelTemplateLine> lines = pDoc->GetPatternLabelTemplate();
|
||||||
if (lines.isEmpty() && m_patternLabelLines->isEmpty())
|
if (lines.isEmpty() && m_patternLabelLinesCache->isEmpty())
|
||||||
{
|
{
|
||||||
return; // Nothing to parse
|
return; // Nothing to parse
|
||||||
}
|
}
|
||||||
|
@ -660,8 +660,8 @@ void VTextManager::Update(VAbstractPattern *pDoc, const VContainer *pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
pDoc->SetPatternWasChanged(false);
|
pDoc->SetPatternWasChanged(false);
|
||||||
*m_patternLabelLines = PrepareLines(lines);
|
*m_patternLabelLinesCache = PrepareLines(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_liLines = *m_patternLabelLines;
|
m_liLines = *m_patternLabelLinesCache;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,10 @@ class QMarginsF;
|
||||||
class VCommonSettings : public QSettings
|
class VCommonSettings : public QSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
public : VCommonSettings(Format format, Scope scope, const QString &organization,
|
|
||||||
const QString &application = QString(), QObject *parent = nullptr);
|
public:
|
||||||
|
VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
|
QObject *parent = nullptr);
|
||||||
VCommonSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
VCommonSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||||
~VCommonSettings() override = default;
|
~VCommonSettings() override = default;
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "../vmisc/typedef.h"
|
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#include "../vmisc/typedef.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
@ -46,43 +46,24 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
|
||||||
class VPatternLabelDataPrivate : public QSharedData
|
class VPatternLabelDataPrivate : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VPatternLabelDataPrivate()
|
VPatternLabelDataPrivate() = default;
|
||||||
: m_dLabelWidth(),
|
VPatternLabelDataPrivate(const VPatternLabelDataPrivate &data) = default;
|
||||||
m_dLabelHeight(),
|
|
||||||
m_dLabelAngle(),
|
|
||||||
m_iFontSize(0),
|
|
||||||
m_centerPin(NULL_ID),
|
|
||||||
m_topLeftPin(NULL_ID),
|
|
||||||
m_bottomRightPin(NULL_ID)
|
|
||||||
{}
|
|
||||||
|
|
||||||
VPatternLabelDataPrivate(const VPatternLabelDataPrivate &data)
|
|
||||||
: QSharedData(data),
|
|
||||||
m_dLabelWidth(data.m_dLabelWidth),
|
|
||||||
m_dLabelHeight(data.m_dLabelHeight),
|
|
||||||
m_dLabelAngle(data.m_dLabelAngle),
|
|
||||||
m_iFontSize(data.m_iFontSize),
|
|
||||||
m_centerPin(data.m_centerPin),
|
|
||||||
m_topLeftPin(data.m_topLeftPin),
|
|
||||||
m_bottomRightPin(data.m_bottomRightPin)
|
|
||||||
{}
|
|
||||||
|
|
||||||
~VPatternLabelDataPrivate() = default;
|
~VPatternLabelDataPrivate() = default;
|
||||||
|
|
||||||
/** @brief m_dLabelWidth formula to calculate the width of label */
|
/** @brief m_dLabelWidth formula to calculate the width of label */
|
||||||
QString m_dLabelWidth;
|
QString m_dLabelWidth{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
/** @brief m_dLabelHeight formula to calculate the height of label */
|
/** @brief m_dLabelHeight formula to calculate the height of label */
|
||||||
QString m_dLabelHeight;
|
QString m_dLabelHeight{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
/** @brief m_dLabelAngle formula to calculate the rotation angle of label */
|
/** @brief m_dLabelAngle formula to calculate the rotation angle of label */
|
||||||
QString m_dLabelAngle;
|
QString m_dLabelAngle{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
/** @brief m_iFontSize label text base font size */
|
/** @brief m_iFontSize label text base font size */
|
||||||
int m_iFontSize;
|
int m_iFontSize{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
/** @brief m_centerPin center pin id */
|
/** @brief m_centerPin center pin id */
|
||||||
quint32 m_centerPin;
|
quint32 m_centerPin{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
/** @brief m_topLeftPin top left corner pin id */
|
/** @brief m_topLeftPin top left corner pin id */
|
||||||
quint32 m_topLeftPin;
|
quint32 m_topLeftPin{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
/** @brief m_bottomRightPin bottom right corner pin id */
|
/** @brief m_bottomRightPin bottom right corner pin id */
|
||||||
quint32 m_bottomRightPin;
|
quint32 m_bottomRightPin{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_ASSIGN_MOVE(VPatternLabelDataPrivate) // NOLINT
|
Q_DISABLE_ASSIGN_MOVE(VPatternLabelDataPrivate) // NOLINT
|
||||||
|
@ -91,4 +72,3 @@ private:
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
#endif // VPATTERNLABELDATA_P_H
|
#endif // VPATTERNLABELDATA_P_H
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,16 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
enum TabOrder {Paths=0, Pins=1, Labels=2, Grainline=3, Passmarks=4, PlaceLabels=5, Count=6};
|
enum TabOrder
|
||||||
|
{
|
||||||
|
Paths = 0,
|
||||||
|
Pins = 1,
|
||||||
|
Labels = 2,
|
||||||
|
Grainline = 3,
|
||||||
|
Passmarks = 4,
|
||||||
|
PlaceLabels = 5,
|
||||||
|
Count = 6
|
||||||
|
};
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -120,8 +129,7 @@ void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
|
||||||
QWidget *parent)
|
|
||||||
: DialogSeamAllowance(data, toolId, parent)
|
: DialogSeamAllowance(data, toolId, parent)
|
||||||
{
|
{
|
||||||
SCASSERT(doc != nullptr)
|
SCASSERT(doc != nullptr)
|
||||||
|
@ -340,9 +348,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
uiTabPaths->lineEditGradationLabel->setText(piece.GetGradationLabel());
|
uiTabPaths->lineEditGradationLabel->setText(piece.GetGradationLabel());
|
||||||
uiTabPaths->spinBoxPriority->setValue(static_cast<int>(piece.GetPriority()));
|
uiTabPaths->spinBoxPriority->setValue(static_cast<int>(piece.GetPriority()));
|
||||||
|
|
||||||
uiTabPaths->plainTextEditFormulaWidth->setPlainText(
|
uiTabPaths->plainTextEditFormulaWidth->setPlainText(VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
VAbstractApplication::VApp()->TrVars()
|
piece.GetFormulaSAWidth(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
->FormulaToUser(piece.GetFormulaSAWidth(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
|
||||||
m_saWidth = piece.GetSAWidth();
|
m_saWidth = piece.GetSAWidth();
|
||||||
|
|
||||||
const VPieceLabelData &ppData = piece.GetPieceLabelData();
|
const VPieceLabelData &ppData = piece.GetPieceLabelData();
|
||||||
|
@ -557,8 +564,8 @@ void DialogSeamAllowance::CheckState()
|
||||||
if (not applyAllowed)
|
if (not applyAllowed)
|
||||||
{
|
{
|
||||||
tooltip = tooltip + QStringLiteral(" <b>") +
|
tooltip = tooltip + QStringLiteral(" <b>") +
|
||||||
tr("To open all detail's features complete creating the main path. Please, press OK.")
|
tr("To open all detail's features complete creating the main path. Please, press OK.") +
|
||||||
+ QStringLiteral("</b>");
|
QStringLiteral("</b>");
|
||||||
}
|
}
|
||||||
uiTabPaths->helpLabel->setText(tooltip);
|
uiTabPaths->helpLabel->setText(tooltip);
|
||||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), QIcon());
|
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), QIcon());
|
||||||
|
@ -878,8 +885,8 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
|
||||||
void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
const int row = uiTabPaths->listWidgetInternalPaths->currentRow();
|
const int row = uiTabPaths->listWidgetInternalPaths->currentRow();
|
||||||
if (uiTabPaths->listWidgetInternalPaths->count() == 0 || row == -1
|
if (uiTabPaths->listWidgetInternalPaths->count() == 0 || row == -1 ||
|
||||||
|| row >= uiTabPaths->listWidgetInternalPaths->count())
|
row >= uiTabPaths->listWidgetInternalPaths->count())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -935,9 +942,8 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos)
|
||||||
void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
const int row = uiTabPlaceLabels->listWidgetPlaceLabels->currentRow();
|
const int row = uiTabPlaceLabels->listWidgetPlaceLabels->currentRow();
|
||||||
if (uiTabPlaceLabels->listWidgetPlaceLabels->count() == 0
|
if (uiTabPlaceLabels->listWidgetPlaceLabels->count() == 0 || row == -1 ||
|
||||||
|| row == -1
|
row >= uiTabPlaceLabels->listWidgetPlaceLabels->count())
|
||||||
|| row >= uiTabPlaceLabels->listWidgetPlaceLabels->count())
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -963,9 +969,8 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
newLabel.SetLabelType(type);
|
newLabel.SetLabelType(type);
|
||||||
m_newPlaceLabels.insert(labelId, newLabel);
|
m_newPlaceLabels.insert(labelId, newLabel);
|
||||||
|
|
||||||
QPointer<VUndoCommand> saveCommand =
|
QPointer<VUndoCommand> saveCommand = new SavePlaceLabelOptions(
|
||||||
new SavePlaceLabelOptions(toolId, currentLabel, newLabel,
|
toolId, currentLabel, newLabel, VAbstractValApplication::VApp()->getCurrentDocument(),
|
||||||
VAbstractValApplication::VApp()->getCurrentDocument(),
|
|
||||||
const_cast<VContainer *>(data), labelId);
|
const_cast<VContainer *>(data), labelId);
|
||||||
m_undoStack.append(saveCommand);
|
m_undoStack.append(saveCommand);
|
||||||
UpdateCurrentPlaceLabelRecords();
|
UpdateCurrentPlaceLabelRecords();
|
||||||
|
@ -1096,8 +1101,8 @@ void DialogSeamAllowance::NodeChanged(int index)
|
||||||
|
|
||||||
QString w1Formula = node.GetFormulaSABefore();
|
QString w1Formula = node.GetFormulaSABefore();
|
||||||
EnableDefButton(uiTabPaths->pushButtonDefBefore, w1Formula);
|
EnableDefButton(uiTabPaths->pushButtonDefBefore, w1Formula);
|
||||||
w1Formula = VAbstractApplication::VApp()->TrVars()
|
w1Formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(w1Formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
w1Formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
if (w1Formula.length() > 80) // increase height if needed.
|
if (w1Formula.length() > 80) // increase height if needed.
|
||||||
{
|
{
|
||||||
this->DeployWidthBeforeFormulaTextEdit();
|
this->DeployWidthBeforeFormulaTextEdit();
|
||||||
|
@ -1111,8 +1116,8 @@ void DialogSeamAllowance::NodeChanged(int index)
|
||||||
|
|
||||||
QString w2Formula = node.GetFormulaSAAfter();
|
QString w2Formula = node.GetFormulaSAAfter();
|
||||||
EnableDefButton(uiTabPaths->pushButtonDefAfter, w2Formula);
|
EnableDefButton(uiTabPaths->pushButtonDefAfter, w2Formula);
|
||||||
w2Formula = VAbstractApplication::VApp()->TrVars()
|
w2Formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(w2Formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
w2Formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
if (w2Formula.length() > 80) // increase height if needed.
|
if (w2Formula.length() > 80) // increase height if needed.
|
||||||
{
|
{
|
||||||
this->DeployWidthAfterFormulaTextEdit();
|
this->DeployWidthAfterFormulaTextEdit();
|
||||||
|
@ -1288,8 +1293,8 @@ void DialogSeamAllowance::NodeAngleChanged(int index)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ReturnDefBefore()
|
void DialogSeamAllowance::ReturnDefBefore()
|
||||||
{
|
{
|
||||||
const QString def = VAbstractApplication::VApp()->TrVars()
|
const QString def = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(def);
|
uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(def);
|
||||||
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||||
{
|
{
|
||||||
|
@ -1300,8 +1305,8 @@ void DialogSeamAllowance::ReturnDefBefore()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ReturnDefAfter()
|
void DialogSeamAllowance::ReturnDefAfter()
|
||||||
{
|
{
|
||||||
const QString def = VAbstractApplication::VApp()->TrVars()
|
const QString def = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(def);
|
uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(def);
|
||||||
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||||
{
|
{
|
||||||
|
@ -1380,9 +1385,8 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
||||||
VPiecePath newPath = dialogTool->GetPiecePath();
|
VPiecePath newPath = dialogTool->GetPiecePath();
|
||||||
m_newPaths.insert(dialogTool->GetToolId(), newPath);
|
m_newPaths.insert(dialogTool->GetToolId(), newPath);
|
||||||
|
|
||||||
QPointer<VUndoCommand> saveCommand =
|
QPointer<VUndoCommand> saveCommand = new SavePiecePathOptions(
|
||||||
new SavePiecePathOptions(toolId, currentPath, newPath,
|
toolId, currentPath, newPath, VAbstractValApplication::VApp()->getCurrentDocument(),
|
||||||
VAbstractValApplication::VApp()->getCurrentDocument(),
|
|
||||||
const_cast<VContainer *>(data), dialogTool->GetToolId());
|
const_cast<VContainer *>(data), dialogTool->GetToolId());
|
||||||
m_undoStack.append(saveCommand);
|
m_undoStack.append(saveCommand);
|
||||||
UpdateCurrentCustomSARecord();
|
UpdateCurrentCustomSARecord();
|
||||||
|
@ -1433,9 +1437,8 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
||||||
|
|
||||||
m_newPlaceLabels.insert(dialogTool->GetToolId(), newLabel);
|
m_newPlaceLabels.insert(dialogTool->GetToolId(), newLabel);
|
||||||
|
|
||||||
QPointer<VUndoCommand> saveCommand =
|
QPointer<VUndoCommand> saveCommand = new SavePlaceLabelOptions(
|
||||||
new SavePlaceLabelOptions(toolId, currentLabel, newLabel,
|
toolId, currentLabel, newLabel, VAbstractValApplication::VApp()->getCurrentDocument(),
|
||||||
VAbstractValApplication::VApp()->getCurrentDocument(),
|
|
||||||
const_cast<VContainer *>(data), dialogTool->GetToolId());
|
const_cast<VContainer *>(data), dialogTool->GetToolId());
|
||||||
m_undoStack.append(saveCommand);
|
m_undoStack.append(saveCommand);
|
||||||
UpdateCurrentPlaceLabelRecords();
|
UpdateCurrentPlaceLabelRecords();
|
||||||
|
@ -1705,8 +1708,8 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
QString qsVal;
|
QString qsVal;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
qsFormula = VAbstractApplication::VApp()->TrVars()
|
qsFormula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) || qIsNaN(dVal))
|
if (qIsInf(dVal) || qIsNaN(dVal))
|
||||||
|
@ -1786,8 +1789,8 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
qsFormula = VAbstractApplication::VApp()->TrVars()
|
qsFormula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) || qIsNaN(dVal))
|
if (qIsInf(dVal) || qIsNaN(dVal))
|
||||||
|
@ -1870,8 +1873,8 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
QString qsVal;
|
QString qsVal;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
qsFormula = VAbstractApplication::VApp()->TrVars()
|
qsFormula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) || qIsNaN(dVal))
|
if (qIsInf(dVal) || qIsNaN(dVal))
|
||||||
|
@ -3131,27 +3134,29 @@ void DialogSeamAllowance::InitMainPathTab()
|
||||||
connect(uiTabPaths->listWidgetMainPath, &QListWidget::itemSelectionChanged, this,
|
connect(uiTabPaths->listWidgetMainPath, &QListWidget::itemSelectionChanged, this,
|
||||||
&DialogSeamAllowance::SetMoveControls);
|
&DialogSeamAllowance::SetMoveControls);
|
||||||
|
|
||||||
connect(uiTabPaths->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this, [this]()
|
connect(uiTabPaths->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this,
|
||||||
{
|
[this]() { ValidObjects(MainPathIsValid()); });
|
||||||
ValidObjects(MainPathIsValid());
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(uiTabPaths->toolButtonTop, &QToolButton::clicked, this, [this]()
|
connect(uiTabPaths->toolButtonTop, &QToolButton::clicked, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
MoveListRowTop(uiTabPaths->listWidgetMainPath);
|
MoveListRowTop(uiTabPaths->listWidgetMainPath);
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
});
|
});
|
||||||
connect(uiTabPaths->toolButtonUp, &QToolButton::clicked, this, [this]()
|
connect(uiTabPaths->toolButtonUp, &QToolButton::clicked, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
MoveListRowUp(uiTabPaths->listWidgetMainPath);
|
MoveListRowUp(uiTabPaths->listWidgetMainPath);
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
});
|
});
|
||||||
connect(uiTabPaths->toolButtonDown, &QToolButton::clicked, this, [this]()
|
connect(uiTabPaths->toolButtonDown, &QToolButton::clicked, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
MoveListRowDown(uiTabPaths->listWidgetMainPath);
|
MoveListRowDown(uiTabPaths->listWidgetMainPath);
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
});
|
});
|
||||||
connect(uiTabPaths->toolButtonBottom, &QToolButton::clicked, this, [this]()
|
connect(uiTabPaths->toolButtonBottom, &QToolButton::clicked, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
MoveListRowBottom(uiTabPaths->listWidgetMainPath);
|
MoveListRowBottom(uiTabPaths->listWidgetMainPath);
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
|
@ -3169,7 +3174,8 @@ void DialogSeamAllowance::InitPieceTab()
|
||||||
uiTabPaths->lineEditName->setClearButtonEnabled(true);
|
uiTabPaths->lineEditName->setClearButtonEnabled(true);
|
||||||
uiTabPaths->lineEditName->setText(GetDefaultPieceName());
|
uiTabPaths->lineEditName->setText(GetDefaultPieceName());
|
||||||
|
|
||||||
connect(uiTabPaths->checkBoxForbidFlipping, &QCheckBox::stateChanged, this, [this](int state)
|
connect(uiTabPaths->checkBoxForbidFlipping, &QCheckBox::stateChanged, this,
|
||||||
|
[this](int state)
|
||||||
{
|
{
|
||||||
if (state == Qt::Checked)
|
if (state == Qt::Checked)
|
||||||
{
|
{
|
||||||
|
@ -3177,7 +3183,8 @@ void DialogSeamAllowance::InitPieceTab()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(uiTabPaths->checkBoxForceFlipping, &QCheckBox::stateChanged, this, [this](int state)
|
connect(uiTabPaths->checkBoxForceFlipping, &QCheckBox::stateChanged, this,
|
||||||
|
[this](int state)
|
||||||
{
|
{
|
||||||
if (state == Qt::Checked)
|
if (state == Qt::Checked)
|
||||||
{
|
{
|
||||||
|
@ -3219,7 +3226,8 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
|
||||||
m_timerWidthAfter->setSingleShot(true);
|
m_timerWidthAfter->setSingleShot(true);
|
||||||
connect(m_timerWidthAfter, &QTimer::timeout, this, &DialogSeamAllowance::EvalWidthAfter);
|
connect(m_timerWidthAfter, &QTimer::timeout, this, &DialogSeamAllowance::EvalWidthAfter);
|
||||||
|
|
||||||
connect(uiTabPaths->checkBoxSeams, &QCheckBox::toggled, this, [this](bool enable)
|
connect(uiTabPaths->checkBoxSeams, &QCheckBox::toggled, this,
|
||||||
|
[this](bool enable)
|
||||||
{
|
{
|
||||||
uiTabPaths->checkBoxBuiltIn->setEnabled(enable);
|
uiTabPaths->checkBoxBuiltIn->setEnabled(enable);
|
||||||
|
|
||||||
|
@ -3234,7 +3242,8 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(uiTabPaths->checkBoxBuiltIn, &QCheckBox::toggled, this, [this](bool enable)
|
connect(uiTabPaths->checkBoxBuiltIn, &QCheckBox::toggled, this,
|
||||||
|
[this](bool enable)
|
||||||
{
|
{
|
||||||
uiTabPaths->groupBoxAutomatic->setEnabled(not enable);
|
uiTabPaths->groupBoxAutomatic->setEnabled(not enable);
|
||||||
uiTabPaths->groupBoxCustom->setEnabled(not enable);
|
uiTabPaths->groupBoxCustom->setEnabled(not enable);
|
||||||
|
@ -3268,36 +3277,30 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
|
||||||
&DialogSeamAllowance::ShowCustomSAContextMenu);
|
&DialogSeamAllowance::ShowCustomSAContextMenu);
|
||||||
connect(uiTabPaths->listWidgetCustomSA, &QListWidget::currentRowChanged, this,
|
connect(uiTabPaths->listWidgetCustomSA, &QListWidget::currentRowChanged, this,
|
||||||
&DialogSeamAllowance::CustomSAChanged);
|
&DialogSeamAllowance::CustomSAChanged);
|
||||||
connect(uiTabPaths->comboBoxStartPoint, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabPaths->comboBoxStartPoint, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogSeamAllowance::CSAStartPointChanged);
|
&DialogSeamAllowance::CSAStartPointChanged);
|
||||||
connect(uiTabPaths->comboBoxEndPoint, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(uiTabPaths->comboBoxEndPoint, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&DialogSeamAllowance::CSAEndPointChanged);
|
&DialogSeamAllowance::CSAEndPointChanged);
|
||||||
connect(uiTabPaths->comboBoxIncludeType, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabPaths->comboBoxIncludeType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogSeamAllowance::CSAIncludeTypeChanged);
|
&DialogSeamAllowance::CSAIncludeTypeChanged);
|
||||||
|
|
||||||
connect(uiTabPaths->toolButtonExprWidth, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidth);
|
connect(uiTabPaths->toolButtonExprWidth, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidth);
|
||||||
connect(uiTabPaths->toolButtonExprBefore, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthBefore);
|
connect(uiTabPaths->toolButtonExprBefore, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthBefore);
|
||||||
connect(uiTabPaths->toolButtonExprAfter, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthAfter);
|
connect(uiTabPaths->toolButtonExprAfter, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthAfter);
|
||||||
|
|
||||||
connect(uiTabPaths->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this, [this]()
|
connect(uiTabPaths->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this,
|
||||||
{
|
[this]() { m_timerWidth->start(formulaTimerTimeout); });
|
||||||
m_timerWidth->start(formulaTimerTimeout);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(uiTabPaths->plainTextEditFormulaWidthBefore, &QPlainTextEdit::textChanged, this, [this]()
|
connect(uiTabPaths->plainTextEditFormulaWidthBefore, &QPlainTextEdit::textChanged, this,
|
||||||
{
|
[this]() { m_timerWidthBefore->start(formulaTimerTimeout); });
|
||||||
m_timerWidthBefore->start(formulaTimerTimeout);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(uiTabPaths->plainTextEditFormulaWidthAfter, &QPlainTextEdit::textChanged, this, [this]()
|
connect(uiTabPaths->plainTextEditFormulaWidthAfter, &QPlainTextEdit::textChanged, this,
|
||||||
{
|
[this]() { m_timerWidthAfter->start(formulaTimerTimeout); });
|
||||||
m_timerWidthAfter->start(formulaTimerTimeout);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(uiTabPaths->pushButtonGrowWidth, &QPushButton::clicked, this,
|
connect(uiTabPaths->pushButtonGrowWidth, &QPushButton::clicked, this,
|
||||||
&DialogSeamAllowance::DeployWidthFormulaTextEdit);
|
&DialogSeamAllowance::DeployWidthFormulaTextEdit);
|
||||||
connect(uiTabPaths->pushButtonGrowWidthBefore, &QPushButton::clicked,
|
connect(uiTabPaths->pushButtonGrowWidthBefore, &QPushButton::clicked, this,
|
||||||
this, &DialogSeamAllowance::DeployWidthBeforeFormulaTextEdit);
|
&DialogSeamAllowance::DeployWidthBeforeFormulaTextEdit);
|
||||||
connect(uiTabPaths->pushButtonGrowWidthAfter, &QPushButton::clicked, this,
|
connect(uiTabPaths->pushButtonGrowWidthAfter, &QPushButton::clicked, this,
|
||||||
&DialogSeamAllowance::DeployWidthAfterFormulaTextEdit);
|
&DialogSeamAllowance::DeployWidthAfterFormulaTextEdit);
|
||||||
}
|
}
|
||||||
|
@ -3398,10 +3401,10 @@ void DialogSeamAllowance::InitLabelsTab()
|
||||||
InitPinPoint(uiTabLabels->comboBoxDLTopLeftPin);
|
InitPinPoint(uiTabLabels->comboBoxDLTopLeftPin);
|
||||||
InitPinPoint(uiTabLabels->comboBoxDLBottomRightPin);
|
InitPinPoint(uiTabLabels->comboBoxDLBottomRightPin);
|
||||||
|
|
||||||
connect(uiTabLabels->comboBoxDLTopLeftPin, &QComboBox::currentTextChanged,
|
connect(uiTabLabels->comboBoxDLTopLeftPin, &QComboBox::currentTextChanged, this,
|
||||||
this, &DialogSeamAllowance::DetailPinPointChanged);
|
&DialogSeamAllowance::DetailPinPointChanged);
|
||||||
connect(uiTabLabels->comboBoxDLBottomRightPin, &QComboBox::currentTextChanged,
|
connect(uiTabLabels->comboBoxDLBottomRightPin, &QComboBox::currentTextChanged, this,
|
||||||
this, &DialogSeamAllowance::DetailPinPointChanged);
|
&DialogSeamAllowance::DetailPinPointChanged);
|
||||||
|
|
||||||
connect(uiTabLabels->pushButtonDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula);
|
connect(uiTabLabels->pushButtonDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula);
|
||||||
connect(uiTabLabels->pushButtonDLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula);
|
connect(uiTabLabels->pushButtonDLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula);
|
||||||
|
@ -3429,10 +3432,10 @@ void DialogSeamAllowance::InitLabelsTab()
|
||||||
InitPinPoint(uiTabLabels->comboBoxPLTopLeftPin);
|
InitPinPoint(uiTabLabels->comboBoxPLTopLeftPin);
|
||||||
InitPinPoint(uiTabLabels->comboBoxPLBottomRightPin);
|
InitPinPoint(uiTabLabels->comboBoxPLBottomRightPin);
|
||||||
|
|
||||||
connect(uiTabLabels->comboBoxPLTopLeftPin, &QComboBox::currentTextChanged,
|
connect(uiTabLabels->comboBoxPLTopLeftPin, &QComboBox::currentTextChanged, this,
|
||||||
this, &DialogSeamAllowance::PatternPinPointChanged);
|
&DialogSeamAllowance::PatternPinPointChanged);
|
||||||
connect(uiTabLabels->comboBoxPLBottomRightPin, &QComboBox::currentTextChanged,
|
connect(uiTabLabels->comboBoxPLBottomRightPin, &QComboBox::currentTextChanged, this,
|
||||||
this, &DialogSeamAllowance::PatternPinPointChanged);
|
&DialogSeamAllowance::PatternPinPointChanged);
|
||||||
|
|
||||||
connect(uiTabLabels->pushButtonPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula);
|
connect(uiTabLabels->pushButtonPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula);
|
||||||
connect(uiTabLabels->pushButtonPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula);
|
connect(uiTabLabels->pushButtonPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula);
|
||||||
|
@ -3488,10 +3491,10 @@ void DialogSeamAllowance::InitLabelsTab()
|
||||||
connect(uiTabLabels->pushButtonPatternMaterials, &QPushButton::clicked, this,
|
connect(uiTabLabels->pushButtonPatternMaterials, &QPushButton::clicked, this,
|
||||||
&DialogSeamAllowance::ManagePatternMaterials);
|
&DialogSeamAllowance::ManagePatternMaterials);
|
||||||
|
|
||||||
connect(uiTabLabels->comboBoxDateFormat, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabLabels->comboBoxDateFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogSeamAllowance::PatternLabelDataChanged);
|
&DialogSeamAllowance::PatternLabelDataChanged);
|
||||||
connect(uiTabLabels->comboBoxTimeFormat, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabLabels->comboBoxTimeFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogSeamAllowance::PatternLabelDataChanged);
|
&DialogSeamAllowance::PatternLabelDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3547,10 +3550,10 @@ void DialogSeamAllowance::InitGrainlineTab()
|
||||||
InitPinPoint(uiTabGrainline->comboBoxGrainlineTopPin);
|
InitPinPoint(uiTabGrainline->comboBoxGrainlineTopPin);
|
||||||
InitPinPoint(uiTabGrainline->comboBoxGrainlineBottomPin);
|
InitPinPoint(uiTabGrainline->comboBoxGrainlineBottomPin);
|
||||||
|
|
||||||
connect(uiTabGrainline->comboBoxGrainlineTopPin, &QComboBox::currentTextChanged,
|
connect(uiTabGrainline->comboBoxGrainlineTopPin, &QComboBox::currentTextChanged, this,
|
||||||
this, &DialogSeamAllowance::GrainlinePinPointChanged);
|
&DialogSeamAllowance::GrainlinePinPointChanged);
|
||||||
connect(uiTabGrainline->comboBoxGrainlineBottomPin, &QComboBox::currentTextChanged,
|
connect(uiTabGrainline->comboBoxGrainlineBottomPin, &QComboBox::currentTextChanged, this,
|
||||||
this, &DialogSeamAllowance::GrainlinePinPointChanged);
|
&DialogSeamAllowance::GrainlinePinPointChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3608,19 +3611,19 @@ void DialogSeamAllowance::InitPassmarksTab()
|
||||||
|
|
||||||
// notch list
|
// notch list
|
||||||
InitPassmarksList();
|
InitPassmarksList();
|
||||||
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogSeamAllowance::PassmarkChanged);
|
&DialogSeamAllowance::PassmarkChanged);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||||
connect(uiTabPassmarks->buttonGroupLineType, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
connect(uiTabPassmarks->buttonGroupLineType, QOverload<int>::of(&QButtonGroup::buttonClicked), this,
|
||||||
this, &DialogSeamAllowance::PassmarkLineTypeChanged);
|
&DialogSeamAllowance::PassmarkLineTypeChanged);
|
||||||
connect(uiTabPassmarks->buttonGroupAngleType, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
connect(uiTabPassmarks->buttonGroupAngleType, QOverload<int>::of(&QButtonGroup::buttonClicked), this,
|
||||||
this, &DialogSeamAllowance::PassmarkAngleTypeChanged);
|
&DialogSeamAllowance::PassmarkAngleTypeChanged);
|
||||||
#else
|
#else
|
||||||
connect(uiTabPassmarks->buttonGroupLineType, &QButtonGroup::idClicked,
|
connect(uiTabPassmarks->buttonGroupLineType, &QButtonGroup::idClicked, this,
|
||||||
this, &DialogSeamAllowance::PassmarkLineTypeChanged);
|
&DialogSeamAllowance::PassmarkLineTypeChanged);
|
||||||
connect(uiTabPassmarks->buttonGroupAngleType, &QButtonGroup::idClicked,
|
connect(uiTabPassmarks->buttonGroupAngleType, &QButtonGroup::idClicked, this,
|
||||||
this, &DialogSeamAllowance::PassmarkAngleTypeChanged);
|
&DialogSeamAllowance::PassmarkAngleTypeChanged);
|
||||||
#endif
|
#endif
|
||||||
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||||
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
||||||
|
@ -3632,7 +3635,8 @@ void DialogSeamAllowance::InitPassmarksTab()
|
||||||
void DialogSeamAllowance::InitPlaceLabelsTab()
|
void DialogSeamAllowance::InitPlaceLabelsTab()
|
||||||
{
|
{
|
||||||
uiTabPlaceLabels->listWidgetPlaceLabels->setContextMenuPolicy(Qt::CustomContextMenu);
|
uiTabPlaceLabels->listWidgetPlaceLabels->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(uiTabPlaceLabels->listWidgetPlaceLabels, &QListWidget::currentRowChanged, this, [this]()
|
connect(uiTabPlaceLabels->listWidgetPlaceLabels, &QListWidget::currentRowChanged, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
if (not m_visSpecialPoints.isNull())
|
if (not m_visSpecialPoints.isNull())
|
||||||
{
|
{
|
||||||
|
@ -3677,8 +3681,8 @@ auto DialogSeamAllowance::UndoStack() -> QVector<QPointer<VUndoCommand>> &
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
||||||
{
|
{
|
||||||
const QString width = VAbstractApplication::VApp()->TrVars()
|
const QString width = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (width.length() > 80)
|
if (width.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3700,8 +3704,8 @@ void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetFormulaPassmarkLength(const QString &formula)
|
void DialogSeamAllowance::SetFormulaPassmarkLength(const QString &formula)
|
||||||
{
|
{
|
||||||
const QString width = VAbstractApplication::VApp()->TrVars()
|
const QString width = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (width.length() > 80)
|
if (width.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3795,8 +3799,8 @@ void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
|
||||||
angleFormula = '0';
|
angleFormula = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(angleFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
angleFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3815,8 +3819,8 @@ void DialogSeamAllowance::SetGrainlineLength(QString lengthFormula)
|
||||||
lengthFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
lengthFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(lengthFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
lengthFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3836,8 +3840,8 @@ void DialogSeamAllowance::SetDLWidth(QString widthFormula)
|
||||||
widthFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
widthFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(widthFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
widthFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3857,8 +3861,8 @@ void DialogSeamAllowance::SetDLHeight(QString heightFormula)
|
||||||
heightFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
heightFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(heightFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
heightFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3878,8 +3882,8 @@ void DialogSeamAllowance::SetDLAngle(QString angleFormula)
|
||||||
angleFormula = '0';
|
angleFormula = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(angleFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
angleFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3899,8 +3903,8 @@ void DialogSeamAllowance::SetPLWidth(QString widthFormula)
|
||||||
widthFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
widthFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(widthFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
widthFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3920,8 +3924,8 @@ void DialogSeamAllowance::SetPLHeight(QString heightFormula)
|
||||||
heightFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
heightFormula = QString().setNum(UnitConvertor(10, Unit::Cm, *data->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(heightFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
heightFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -3941,8 +3945,8 @@ void DialogSeamAllowance::SetPLAngle(QString angleFormula)
|
||||||
angleFormula = '0';
|
angleFormula = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
->FormulaToUser(angleFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
angleFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -4149,26 +4153,26 @@ void DialogSeamAllowance::InitGradationPlaceholders()
|
||||||
|
|
||||||
{
|
{
|
||||||
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
||||||
m_gradationPlaceholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"),
|
m_gradationPlaceholders.insert(
|
||||||
not label.isEmpty() ? label : heightValue));
|
pl_heightLabel, qMakePair(tr("Height label", "dimension"), not label.isEmpty() ? label : heightValue));
|
||||||
m_gradationPlaceholders.insert(pl_dimensionXLabel, qMakePair(tr("Dimension X label", "dimension"),
|
m_gradationPlaceholders.insert(pl_dimensionXLabel, qMakePair(tr("Dimension X label", "dimension"),
|
||||||
not label.isEmpty() ? label : heightValue));
|
not label.isEmpty() ? label : heightValue));
|
||||||
|
|
||||||
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
||||||
m_gradationPlaceholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"),
|
m_gradationPlaceholders.insert(
|
||||||
not label.isEmpty() ? label : sizeValue));
|
pl_sizeLabel, qMakePair(tr("Size label", "dimension"), not label.isEmpty() ? label : sizeValue));
|
||||||
m_gradationPlaceholders.insert(pl_dimensionYLabel, qMakePair(tr("Dimension Y label", "dimension"),
|
m_gradationPlaceholders.insert(pl_dimensionYLabel, qMakePair(tr("Dimension Y label", "dimension"),
|
||||||
not label.isEmpty() ? label : sizeValue));
|
not label.isEmpty() ? label : sizeValue));
|
||||||
|
|
||||||
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
||||||
m_gradationPlaceholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"),
|
m_gradationPlaceholders.insert(pl_hipLabel,
|
||||||
not label.isEmpty() ? label : hipValue));
|
qMakePair(tr("Hip label", "dimension"), not label.isEmpty() ? label : hipValue));
|
||||||
m_gradationPlaceholders.insert(pl_dimensionZLabel, qMakePair(tr("Dimension Z label", "dimension"),
|
m_gradationPlaceholders.insert(pl_dimensionZLabel, qMakePair(tr("Dimension Z label", "dimension"),
|
||||||
not label.isEmpty() ? label : hipValue));
|
not label.isEmpty() ? label : hipValue));
|
||||||
|
|
||||||
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
||||||
m_gradationPlaceholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"),
|
m_gradationPlaceholders.insert(
|
||||||
not label.isEmpty() ? label : waistValue));
|
pl_waistLabel, qMakePair(tr("Waist label", "dimension"), not label.isEmpty() ? label : waistValue));
|
||||||
m_gradationPlaceholders.insert(pl_dimensionWLabel, qMakePair(tr("Dimension W label", "dimension"),
|
m_gradationPlaceholders.insert(pl_dimensionWLabel, qMakePair(tr("Dimension W label", "dimension"),
|
||||||
not label.isEmpty() ? label : waistValue));
|
not label.isEmpty() ? label : waistValue));
|
||||||
}
|
}
|
||||||
|
@ -4179,9 +4183,9 @@ void DialogSeamAllowance::InitGradationPlaceholders()
|
||||||
while (i != measurements.constEnd())
|
while (i != measurements.constEnd())
|
||||||
{
|
{
|
||||||
QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText();
|
QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText();
|
||||||
m_gradationPlaceholders.insert(pl_measurement + i.key(),
|
m_gradationPlaceholders.insert(
|
||||||
qMakePair(tr("Measurement: %1").arg(description),
|
pl_measurement + i.key(),
|
||||||
QString::number(*i.value()->GetValue())));
|
qMakePair(tr("Measurement: %1").arg(description), QString::number(*i.value()->GetValue())));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4448,7 +4452,8 @@ void DialogSeamAllowance::EditPatternLabel()
|
||||||
{
|
{
|
||||||
if (m_patternLabelDataChanged && m_askSavePatternLabelData)
|
if (m_patternLabelDataChanged && m_askSavePatternLabelData)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Save label data."),
|
QMessageBox::StandardButton answer = QMessageBox::question(
|
||||||
|
this, tr("Save label data."),
|
||||||
tr("Label data were changed. Do you want to save them before editing label template?"),
|
tr("Label data were changed. Do you want to save them before editing label template?"),
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Ui
|
||||||
class TabPins;
|
class TabPins;
|
||||||
class TabPassmarks;
|
class TabPassmarks;
|
||||||
class TabPlaceLabels;
|
class TabPlaceLabels;
|
||||||
}
|
} // namespace Ui
|
||||||
|
|
||||||
class VisPieceSpecialPoints;
|
class VisPieceSpecialPoints;
|
||||||
class FancyTabBar;
|
class FancyTabBar;
|
||||||
|
@ -54,8 +54,7 @@ class DialogSeamAllowance : public DialogTool
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
|
||||||
QWidget *parent = nullptr);
|
|
||||||
DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||||
~DialogSeamAllowance() override;
|
~DialogSeamAllowance() override;
|
||||||
|
|
||||||
|
|
|
@ -57,14 +57,11 @@ class VToolSeamAllowance : public VInteractiveTool, public QGraphicsPathItem
|
||||||
public:
|
public:
|
||||||
~VToolSeamAllowance() override = default;
|
~VToolSeamAllowance() override = default;
|
||||||
|
|
||||||
static auto Create(const QPointer<DialogTool> &dialog,
|
static auto Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VMainGraphicsScene *scene,
|
|
||||||
VAbstractPattern *doc,
|
|
||||||
VContainer *data) -> VToolSeamAllowance *;
|
VContainer *data) -> VToolSeamAllowance *;
|
||||||
static auto Create(VToolSeamAllowanceInitData &initData) -> VToolSeamAllowance *;
|
static auto Create(VToolSeamAllowanceInitData &initData) -> VToolSeamAllowance *;
|
||||||
static auto Duplicate(const QPointer<DialogTool> &dialog,
|
static auto Duplicate(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc)
|
||||||
VMainGraphicsScene *scene,
|
-> VToolSeamAllowance *;
|
||||||
VAbstractPattern *doc) -> VToolSeamAllowance *;
|
|
||||||
static auto Duplicate(VToolSeamAllowanceInitData &initData) -> VToolSeamAllowance *;
|
static auto Duplicate(VToolSeamAllowanceInitData &initData) -> VToolSeamAllowance *;
|
||||||
|
|
||||||
static const quint8 pieceVersion;
|
static const quint8 pieceVersion;
|
||||||
|
@ -89,32 +86,16 @@ public:
|
||||||
|
|
||||||
void RemoveWithConfirm(bool ask);
|
void RemoveWithConfirm(bool ask);
|
||||||
|
|
||||||
static void InsertNodes(const QVector<VPieceNode> &nodes,
|
static void InsertNodes(const QVector<VPieceNode> &nodes, quint32 pieceId, VMainGraphicsScene *scene,
|
||||||
quint32 pieceId,
|
VContainer *data, VAbstractPattern *doc);
|
||||||
VMainGraphicsScene *scene,
|
|
||||||
VContainer *data,
|
|
||||||
VAbstractPattern *doc);
|
|
||||||
|
|
||||||
static void AddAttributes(VAbstractPattern *doc,
|
static void AddAttributes(VAbstractPattern *doc, QDomElement &domElement, quint32 id, const VPiece &piece);
|
||||||
QDomElement &domElement,
|
|
||||||
quint32 id,
|
|
||||||
const VPiece &piece);
|
|
||||||
static void AddCSARecord(VAbstractPattern *doc, QDomElement &domElement, CustomSARecord record);
|
static void AddCSARecord(VAbstractPattern *doc, QDomElement &domElement, CustomSARecord record);
|
||||||
static void AddCSARecords(VAbstractPattern *doc,
|
static void AddCSARecords(VAbstractPattern *doc, QDomElement &domElement, const QVector<CustomSARecord> &records);
|
||||||
QDomElement &domElement,
|
static void AddInternalPaths(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &paths);
|
||||||
const QVector<CustomSARecord> &records);
|
static void AddPins(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &pins);
|
||||||
static void AddInternalPaths(VAbstractPattern *doc,
|
static void AddPlaceLabels(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &placeLabels);
|
||||||
QDomElement &domElement,
|
static void AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
||||||
const QVector<quint32> &paths);
|
|
||||||
static void AddPins(VAbstractPattern *doc,
|
|
||||||
QDomElement &domElement,
|
|
||||||
const QVector<quint32> &pins);
|
|
||||||
static void AddPlaceLabels(VAbstractPattern *doc,
|
|
||||||
QDomElement &domElement,
|
|
||||||
const QVector<quint32> &placeLabels);
|
|
||||||
static void AddPatternPieceData(VAbstractPattern *doc,
|
|
||||||
QDomElement &domElement,
|
|
||||||
const VPiece &piece);
|
|
||||||
static void AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
static void AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
||||||
static void AddGrainline(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
static void AddGrainline(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
||||||
|
|
||||||
|
@ -126,7 +107,10 @@ public:
|
||||||
void RefreshGeometry(bool updateChildren = true);
|
void RefreshGeometry(bool updateChildren = true);
|
||||||
|
|
||||||
auto type() const -> int override { return Type; }
|
auto type() const -> int override { return Type; }
|
||||||
enum { Type = UserType + static_cast<int>(Tool::Piece) };
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Tool::Piece)
|
||||||
|
};
|
||||||
|
|
||||||
auto getTagName() const -> QString override;
|
auto getTagName() const -> QString override;
|
||||||
void ShowVisualization(bool show) override;
|
void ShowVisualization(bool show) override;
|
||||||
|
@ -211,66 +195,45 @@ private:
|
||||||
/** @brief m_geometryIsReady is true when a piece's geometry is ready and checks for validity can be enabled. */
|
/** @brief m_geometryIsReady is true when a piece's geometry is ready and checks for validity can be enabled. */
|
||||||
bool m_geometryIsReady{false};
|
bool m_geometryIsReady{false};
|
||||||
|
|
||||||
explicit VToolSeamAllowance(const VToolSeamAllowanceInitData &initData,
|
explicit VToolSeamAllowance(const VToolSeamAllowanceInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
QGraphicsItem *parent = nullptr);
|
|
||||||
|
|
||||||
void UpdateExcludeState();
|
void UpdateExcludeState();
|
||||||
void UpdateInternalPaths();
|
void UpdateInternalPaths();
|
||||||
|
|
||||||
auto FindLabelGeometry(const VPatternLabelData &labelData,
|
auto FindLabelGeometry(const VPatternLabelData &labelData, const QVector<quint32> &pins, qreal &rotationAngle,
|
||||||
const QVector<quint32> &pins,
|
qreal &labelWidth, qreal &labelHeight, QPointF &pos) -> VPieceItem::MoveTypes;
|
||||||
qreal &rotationAngle,
|
auto FindGrainlineGeometry(const VGrainlineData &geom, const QVector<quint32> &pins, qreal &length,
|
||||||
qreal &labelWidth,
|
qreal &rotationAngle, QPointF &pos) -> VPieceItem::MoveTypes;
|
||||||
qreal &labelHeight,
|
|
||||||
QPointF &pos) -> VPieceItem::MoveTypes;
|
|
||||||
auto FindGrainlineGeometry(const VGrainlineData &geom,
|
|
||||||
const QVector<quint32> &pins,
|
|
||||||
qreal &length,
|
|
||||||
qreal &rotationAngle,
|
|
||||||
QPointF &pos) -> VPieceItem::MoveTypes;
|
|
||||||
|
|
||||||
void InitNodes(const VPiece &detail, VMainGraphicsScene *scene);
|
void InitNodes(const VPiece &detail, VMainGraphicsScene *scene);
|
||||||
static void InitNode(const VPieceNode &node,
|
static void InitNode(const VPieceNode &node, VMainGraphicsScene *scene, VToolSeamAllowance *parent);
|
||||||
VMainGraphicsScene *scene,
|
|
||||||
VToolSeamAllowance *parent);
|
|
||||||
void InitCSAPaths(const VPiece &detail) const;
|
void InitCSAPaths(const VPiece &detail) const;
|
||||||
void InitInternalPaths(const VPiece &detail);
|
void InitInternalPaths(const VPiece &detail);
|
||||||
void InitSpecialPoints(const QVector<quint32> &points) const;
|
void InitSpecialPoints(const QVector<quint32> &points) const;
|
||||||
|
|
||||||
auto PrepareLabelData(const VPatternLabelData &labelData,
|
auto PrepareLabelData(const VPatternLabelData &labelData, const QVector<quint32> &pins,
|
||||||
const QVector<quint32> &pins,
|
VTextGraphicsItem *labelItem, QPointF &pos, qreal &labelAngle) -> bool;
|
||||||
VTextGraphicsItem *labelItem,
|
|
||||||
QPointF &pos,
|
|
||||||
qreal &labelAngle) -> bool;
|
|
||||||
|
|
||||||
auto SelectedTools() const -> QList<VToolSeamAllowance *>;
|
auto SelectedTools() const -> QList<VToolSeamAllowance *>;
|
||||||
|
|
||||||
auto IsGrainlinePositionValid() const -> bool;
|
auto IsGrainlinePositionValid() const -> bool;
|
||||||
|
|
||||||
static void AddPointRecords(VAbstractPattern *doc,
|
static void AddPointRecords(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &records,
|
||||||
QDomElement &domElement,
|
|
||||||
const QVector<quint32> &records,
|
|
||||||
const QString &tag);
|
const QString &tag);
|
||||||
|
|
||||||
static auto DuplicateNodes(const VPiecePath &path,
|
static auto DuplicateNodes(const VPiecePath &path, const VToolSeamAllowanceInitData &initData,
|
||||||
const VToolSeamAllowanceInitData &initData,
|
|
||||||
QMap<quint32, quint32> &replacements) -> QVector<VPieceNode>;
|
QMap<quint32, quint32> &replacements) -> QVector<VPieceNode>;
|
||||||
static auto DuplicateNode(const VPieceNode &node, const VToolSeamAllowanceInitData &initData)
|
static auto DuplicateNode(const VPieceNode &node, const VToolSeamAllowanceInitData &initData) -> quint32;
|
||||||
-> quint32;
|
|
||||||
|
|
||||||
static auto DuplicatePiecePath(quint32 id, const VToolSeamAllowanceInitData &initData)
|
static auto DuplicatePiecePath(quint32 id, const VToolSeamAllowanceInitData &initData) -> quint32;
|
||||||
-> quint32;
|
|
||||||
|
|
||||||
static auto DuplicateCustomSARecords(const QVector<CustomSARecord> &records,
|
static auto DuplicateCustomSARecords(const QVector<CustomSARecord> &records,
|
||||||
const VToolSeamAllowanceInitData &initData,
|
const VToolSeamAllowanceInitData &initData,
|
||||||
const QMap<quint32, quint32> &replacements)
|
const QMap<quint32, quint32> &replacements) -> QVector<CustomSARecord>;
|
||||||
-> QVector<CustomSARecord>;
|
|
||||||
|
|
||||||
static auto DuplicateInternalPaths(const QVector<quint32> &iPaths,
|
static auto DuplicateInternalPaths(const QVector<quint32> &iPaths, const VToolSeamAllowanceInitData &initData)
|
||||||
const VToolSeamAllowanceInitData &initData)
|
|
||||||
-> QVector<quint32>;
|
-> QVector<quint32>;
|
||||||
static auto DuplicatePlaceLabels(const QVector<quint32> &placeLabels,
|
static auto DuplicatePlaceLabels(const QVector<quint32> &placeLabels, const VToolSeamAllowanceInitData &initData)
|
||||||
const VToolSeamAllowanceInitData &initData)
|
|
||||||
-> QVector<quint32>;
|
-> QVector<quint32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ void VGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphic
|
||||||
{
|
{
|
||||||
auto UpdateLine = [this]()
|
auto UpdateLine = [this]()
|
||||||
{
|
{
|
||||||
if (VScenePoint *parent = dynamic_cast<VScenePoint *>(parentItem()))
|
if (auto *parent = dynamic_cast<VScenePoint *>(parentItem()))
|
||||||
{
|
{
|
||||||
parent->RefreshLine();
|
parent->RefreshLine();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDebug>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
@ -37,24 +38,22 @@
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QStyleOptionGraphicsItem>
|
#include <QStyleOptionGraphicsItem>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include "../vmisc/vmath.h"
|
|
||||||
#include "../vmisc/literals.h"
|
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vmisc/literals.h"
|
||||||
#include "vtextgraphicsitem.h"
|
#include "vtextgraphicsitem.h"
|
||||||
|
|
||||||
const qreal resizeSquare = MmToPixel(3.);
|
|
||||||
const qreal rotateCircle = MmToPixel(2.);
|
|
||||||
#define ROTATE_RECT 60
|
|
||||||
#define ROTATE_ARC 50
|
|
||||||
const qreal minW = MmToPixel(4.) + resizeSquare;
|
|
||||||
const qreal minH = MmToPixel(4.) + resizeSquare;
|
|
||||||
#define ACTIVE_Z 10
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
constexpr qreal resizeSquare = MmToPixel(3.);
|
||||||
|
constexpr qreal rotateCircle = MmToPixel(2.);
|
||||||
|
constexpr int rotateRect = 60;
|
||||||
|
constexpr int rotateArc = 50;
|
||||||
|
constexpr qreal minW = MmToPixel(4.) + resizeSquare;
|
||||||
|
constexpr qreal minH = MmToPixel(4.) + resizeSquare;
|
||||||
|
constexpr int activeZ = 10;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief GetBoundingRect calculates the bounding box around rectBB rectangle, rotated around its center by dRot degrees
|
* @brief GetBoundingRect calculates the bounding box around rectBB rectangle, rotated around its center by dRot degrees
|
||||||
|
@ -64,7 +63,7 @@ namespace
|
||||||
*/
|
*/
|
||||||
auto GetBoundingRect(const QRectF &rectBB, qreal dRot) -> QRectF
|
auto GetBoundingRect(const QRectF &rectBB, qreal dRot) -> QRectF
|
||||||
{
|
{
|
||||||
QPointF apt[4] = { rectBB.topLeft(), rectBB.topRight(), rectBB.bottomLeft(), rectBB.bottomRight() };
|
std::array<QPointF, 4> apt = {rectBB.topLeft(), rectBB.topRight(), rectBB.bottomLeft(), rectBB.bottomRight()};
|
||||||
QPointF ptCenter = rectBB.center();
|
QPointF ptCenter = rectBB.center();
|
||||||
|
|
||||||
qreal dX1 = 0;
|
qreal dX1 = 0;
|
||||||
|
@ -73,9 +72,9 @@ auto GetBoundingRect(const QRectF &rectBB, qreal dRot) -> QRectF
|
||||||
qreal dY2 = 0;
|
qreal dY2 = 0;
|
||||||
|
|
||||||
double dAng = qDegreesToRadians(dRot);
|
double dAng = qDegreesToRadians(dRot);
|
||||||
for (int i = 0; i < 4; ++i)
|
for (std::size_t i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
QPointF pt = apt[i] - ptCenter;
|
QPointF pt = apt.at(i) - ptCenter;
|
||||||
qreal dX = pt.x() * cos(dAng) + pt.y() * sin(dAng);
|
qreal dX = pt.x() * cos(dAng) + pt.y() * sin(dAng);
|
||||||
qreal dY = -pt.x() * sin(dAng) + pt.y() * cos(dAng);
|
qreal dY = -pt.x() * sin(dAng) + pt.y() * cos(dAng);
|
||||||
|
|
||||||
|
@ -110,7 +109,7 @@ auto GetBoundingRect(const QRectF &rectBB, qreal dRot) -> QRectF
|
||||||
rect.setHeight(dY2 - dY1);
|
rect.setHeight(dY2 - dY1);
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
}//static functions
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -118,14 +117,7 @@ auto GetBoundingRect(const QRectF &rectBB, qreal dRot) -> QRectF
|
||||||
* @param pParent pointer to the parent item
|
* @param pParent pointer to the parent item
|
||||||
*/
|
*/
|
||||||
VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem *pParent)
|
VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem *pParent)
|
||||||
: VPieceItem(pParent),
|
: VPieceItem(pParent)
|
||||||
m_ptStartPos(),
|
|
||||||
m_ptStart(),
|
|
||||||
m_szStart(),
|
|
||||||
m_dRotation(0),
|
|
||||||
m_dAngle(0),
|
|
||||||
m_rectResize(),
|
|
||||||
m_tm()
|
|
||||||
{
|
{
|
||||||
m_inactiveZ = 2;
|
m_inactiveZ = 2;
|
||||||
SetSize(minW, minH);
|
SetSize(minW, minH);
|
||||||
|
@ -214,24 +206,21 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
// in rotate mode, draw the circle in the middle
|
// in rotate mode, draw the circle in the middle
|
||||||
painter->setPen(Qt::black);
|
painter->setPen(Qt::black);
|
||||||
painter->setBrush(Qt::black);
|
painter->setBrush(Qt::black);
|
||||||
painter->drawEllipse(
|
painter->drawEllipse(QPointF(m_rectBoundingBox.width() / 2, m_rectBoundingBox.height() / 2), rotateCircle,
|
||||||
QPointF(m_rectBoundingBox.width()/2, m_rectBoundingBox.height()/2),
|
rotateCircle);
|
||||||
rotateCircle,
|
|
||||||
rotateCircle
|
|
||||||
);
|
|
||||||
if (m_rectBoundingBox.width() > minW * 3 && m_rectBoundingBox.height() > minH * 3)
|
if (m_rectBoundingBox.width() > minW * 3 && m_rectBoundingBox.height() > minH * 3)
|
||||||
{
|
{
|
||||||
painter->setPen(QPen(Qt::black, 3));
|
painter->setPen(QPen(Qt::black, 3));
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
// and then draw the arc in each of the corners
|
// and then draw the arc in each of the corners
|
||||||
int iTop = ROTATE_RECT - ROTATE_ARC;
|
int iTop = rotateRect - rotateArc;
|
||||||
int iLeft = ROTATE_RECT - ROTATE_ARC;
|
int iLeft = rotateRect - rotateArc;
|
||||||
int iRight = qRound(m_rectBoundingBox.width()) - ROTATE_RECT;
|
int iRight = qRound(m_rectBoundingBox.width()) - rotateRect;
|
||||||
int iBottom = qRound(m_rectBoundingBox.height()) - ROTATE_RECT;
|
int iBottom = qRound(m_rectBoundingBox.height()) - rotateRect;
|
||||||
painter->drawArc(iLeft, iTop, ROTATE_ARC, ROTATE_ARC, 180*16, -90*16);
|
painter->drawArc(iLeft, iTop, rotateArc, rotateArc, 180 * 16, -90 * 16);
|
||||||
painter->drawArc(iRight, iTop, ROTATE_ARC, ROTATE_ARC, 90*16, -90*16);
|
painter->drawArc(iRight, iTop, rotateArc, rotateArc, 90 * 16, -90 * 16);
|
||||||
painter->drawArc(iLeft, iBottom, ROTATE_ARC, ROTATE_ARC, 270*16, -90*16);
|
painter->drawArc(iLeft, iBottom, rotateArc, rotateArc, 270 * 16, -90 * 16);
|
||||||
painter->drawArc(iRight, iBottom, ROTATE_ARC, ROTATE_ARC, 0*16, -90*16);
|
painter->drawArc(iRight, iBottom, rotateArc, rotateArc, 0 * 16, -90 * 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,7 +273,7 @@ auto VTextGraphicsItem::IsContained(QRectF rectBB, qreal dRot, qreal &dX, qreal
|
||||||
dX = 0;
|
dX = 0;
|
||||||
dY = 0;
|
dY = 0;
|
||||||
|
|
||||||
if (rectParent.contains(rectBB) == false)
|
if (not rectParent.contains(rectBB))
|
||||||
{
|
{
|
||||||
if (rectParent.left() - rectBB.left() > fabs(dX))
|
if (rectParent.left() - rectBB.left() > fabs(dX))
|
||||||
{
|
{
|
||||||
|
@ -357,8 +346,8 @@ auto VTextGraphicsItem::GetFontSize() const -> int
|
||||||
*/
|
*/
|
||||||
void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
{
|
{
|
||||||
if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick
|
if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick &&
|
||||||
&& (flags() & QGraphicsItem::ItemIsMovable))
|
(flags() & QGraphicsItem::ItemIsMovable))
|
||||||
{
|
{
|
||||||
if (m_moveType == NotMovable)
|
if (m_moveType == NotMovable)
|
||||||
{
|
{
|
||||||
|
@ -381,7 +370,7 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
if ((m_moveType & AllModifications) == AllModifications)
|
if ((m_moveType & AllModifications) == AllModifications)
|
||||||
{
|
{
|
||||||
AllUserModifications(pME->pos());
|
AllUserModifications(pME->pos());
|
||||||
setZValue(ACTIVE_Z);
|
setZValue(activeZ);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
else if (m_moveType & IsRotatable)
|
else if (m_moveType & IsRotatable)
|
||||||
|
@ -399,7 +388,7 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
m_eMode = mRotate;
|
m_eMode = mRotate;
|
||||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||||
}
|
}
|
||||||
setZValue(ACTIVE_Z);
|
setZValue(activeZ);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
else if (m_moveType & IsResizable)
|
else if (m_moveType & IsResizable)
|
||||||
|
@ -412,7 +401,7 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
{
|
{
|
||||||
UserMoveAndResize(pME->pos());
|
UserMoveAndResize(pME->pos());
|
||||||
}
|
}
|
||||||
setZValue(ACTIVE_Z);
|
setZValue(activeZ);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
else if (m_moveType & IsMovable)
|
else if (m_moveType & IsMovable)
|
||||||
|
@ -431,7 +420,7 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setZValue(ACTIVE_Z);
|
setZValue(activeZ);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -452,100 +441,17 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
*/
|
*/
|
||||||
void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME)
|
void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
{
|
{
|
||||||
qreal dX;
|
|
||||||
qreal dY;
|
|
||||||
QRectF rectBB;
|
|
||||||
if (m_eMode == mMove && m_moveType & IsMovable)
|
if (m_eMode == mMove && m_moveType & IsMovable)
|
||||||
{
|
{
|
||||||
const QPointF ptDiff = pME->scenePos() - m_ptStart;
|
MoveLabel(pME);
|
||||||
// in move mode move the label along the mouse move from the origin
|
|
||||||
QPointF pt = m_ptStartPos + ptDiff;
|
|
||||||
rectBB.setTopLeft(pt);
|
|
||||||
rectBB.setWidth(m_rectBoundingBox.width());
|
|
||||||
rectBB.setHeight(m_rectBoundingBox.height());
|
|
||||||
// before moving label to a new position, check if it will still be inside the parent item
|
|
||||||
if (IsContained(rectBB, rotation(), dX, dY) == false)
|
|
||||||
{
|
|
||||||
pt.setX(pt.x() + dX);
|
|
||||||
pt.setY(pt.y() + dY);
|
|
||||||
}
|
|
||||||
setPos(pt);
|
|
||||||
UpdateBox();
|
|
||||||
}
|
}
|
||||||
else if (m_eMode == mResize && m_moveType & IsResizable)
|
else if (m_eMode == mResize && m_moveType & IsResizable)
|
||||||
{
|
{
|
||||||
QLineF vectorDiff(m_ptStart, pME->scenePos());
|
ResizeLabel(pME);
|
||||||
vectorDiff.setAngle(vectorDiff.angle() + m_dRotation);
|
|
||||||
const QPointF ptDiff = vectorDiff.p2() - m_ptStart;
|
|
||||||
|
|
||||||
// in resize mode, resize the label along the mouse move from the origin
|
|
||||||
QPointF pt;
|
|
||||||
QSizeF sz;
|
|
||||||
|
|
||||||
if (m_moveType & IsMovable)
|
|
||||||
{
|
|
||||||
const qreal newWidth = m_szStart.width() + ptDiff.x();
|
|
||||||
const qreal newHeight = m_szStart.height() + ptDiff.y();
|
|
||||||
if (newWidth <= minW || newHeight <= minH)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pt = m_ptStartPos;
|
|
||||||
sz = QSizeF(newWidth, newHeight);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const qreal newWidth = m_szStart.width() + ptDiff.x()*2.0;
|
|
||||||
const qreal newHeight = m_szStart.height() + ptDiff.y()*2.0;
|
|
||||||
if (newWidth <= minW || newHeight <= minH)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pt = QPointF(m_ptRotCenter.x() - newWidth/2.0, m_ptRotCenter.y() - newHeight/2.0);
|
|
||||||
sz = QSizeF(m_szStart.width() + ptDiff.x()*2.0, m_szStart.height() + ptDiff.y()*2.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rectBB.setTopLeft(pt);
|
|
||||||
rectBB.setSize(sz);
|
|
||||||
// before resizing the label to a new size, check if it will still be inside the parent item
|
|
||||||
if (IsContained(rectBB, rotation(), dX, dY))
|
|
||||||
{
|
|
||||||
if (not (m_moveType & IsMovable))
|
|
||||||
{
|
|
||||||
setPos(pt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetSize(sz.width(), sz.height());
|
|
||||||
Update();
|
|
||||||
emit SignalShrink();
|
|
||||||
}
|
}
|
||||||
else if (m_eMode == mRotate && m_moveType & IsRotatable)
|
else if (m_eMode == mRotate && m_moveType & IsRotatable)
|
||||||
{
|
{
|
||||||
// if the angle from the original position is small (0.5 degrees), just remeber the new angle
|
RotateLabel(pME);
|
||||||
// new angle will be the starting angle for rotation
|
|
||||||
if (fabs(m_dAngle) < 0.01)
|
|
||||||
{
|
|
||||||
m_dAngle = GetAngle(mapToParent(pME->pos()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// calculate the angle difference from the starting angle
|
|
||||||
double dAng = qRadiansToDegrees(GetAngle(mapToParent(pME->pos())) - m_dAngle);
|
|
||||||
rectBB.setTopLeft(m_ptStartPos);
|
|
||||||
rectBB.setWidth(m_rectBoundingBox.width());
|
|
||||||
rectBB.setHeight(m_rectBoundingBox.height());
|
|
||||||
// check if the rotated label will be inside the parent item and then rotate it
|
|
||||||
if (IsContained(rectBB, m_dRotation + dAng, dX, dY) == true)
|
|
||||||
{
|
|
||||||
setRotation(m_dRotation + dAng);
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,23 +462,28 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
*/
|
*/
|
||||||
void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *pME)
|
void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
{
|
{
|
||||||
if (pME->button() == Qt::LeftButton)
|
if (pME->button() != Qt::LeftButton)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// restore the cursor
|
// restore the cursor
|
||||||
if ((m_eMode == mMove || m_eMode == mRotate || m_eMode == mResize) && (flags() & QGraphicsItem::ItemIsMovable))
|
if ((m_eMode == mMove || m_eMode == mRotate || m_eMode == mResize) && (flags() & QGraphicsItem::ItemIsMovable))
|
||||||
{
|
{
|
||||||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
double dDist = fabs(pME->scenePos().x() - m_ptStart.x()) + fabs(pME->scenePos().y() - m_ptStart.y());
|
double dDist = fabs(pME->scenePos().x() - m_ptStart.x()) + fabs(pME->scenePos().y() - m_ptStart.y());
|
||||||
// determine if this was just press/release (bShort == true) or user did some operation between press and release
|
// determine if this was just press/release (bShort == true) or user did some operation between press and
|
||||||
|
// release
|
||||||
bool bShort = (dDist < 2);
|
bool bShort = (dDist < 2);
|
||||||
|
|
||||||
if (m_eMode == mMove || m_eMode == mResize)
|
if (m_eMode == mMove || m_eMode == mResize)
|
||||||
{ // if user just pressed and released the button, we must switch the mode to rotate
|
{ // if user just pressed and released the button, we must switch the mode to rotate
|
||||||
// but if user did some operation (move/resize), emit the proper signal and update the label
|
// but if user did some operation (move/resize), emit the proper signal and update the label
|
||||||
if (bShort == true)
|
if (bShort)
|
||||||
{
|
{
|
||||||
if (m_bReleased == true && m_moveType & IsRotatable)
|
if (m_bReleased && m_moveType & IsRotatable)
|
||||||
{
|
{
|
||||||
m_eMode = mRotate;
|
m_eMode = mRotate;
|
||||||
UpdateBox();
|
UpdateBox();
|
||||||
|
@ -591,7 +502,7 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // in rotate mode, if user did just press/release, switch to move mode
|
{ // in rotate mode, if user did just press/release, switch to move mode
|
||||||
if (bShort == true && (m_moveType & IsMovable || m_moveType & IsResizable))
|
if (bShort && (m_moveType & IsMovable || m_moveType & IsResizable))
|
||||||
{
|
{
|
||||||
m_eMode = mMove;
|
m_eMode = mMove;
|
||||||
}
|
}
|
||||||
|
@ -604,7 +515,6 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
}
|
}
|
||||||
m_bReleased = true;
|
m_bReleased = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -615,7 +525,7 @@ void VTextGraphicsItem::hoverMoveEvent(QGraphicsSceneHoverEvent* pHE)
|
||||||
{
|
{
|
||||||
if (m_eMode == mResize && m_moveType & IsResizable)
|
if (m_eMode == mResize && m_moveType & IsResizable)
|
||||||
{
|
{
|
||||||
if (m_rectResize.contains(pHE->pos()) == true)
|
if (m_rectResize.contains(pHE->pos()))
|
||||||
{
|
{
|
||||||
setCursor(Qt::SizeFDiagCursor);
|
setCursor(Qt::SizeFDiagCursor);
|
||||||
}
|
}
|
||||||
|
@ -658,7 +568,7 @@ void VTextGraphicsItem::CorrectLabel()
|
||||||
QRectF rectBB;
|
QRectF rectBB;
|
||||||
rectBB.setTopLeft(pos());
|
rectBB.setTopLeft(pos());
|
||||||
rectBB.setSize(m_rectBoundingBox.size());
|
rectBB.setSize(m_rectBoundingBox.size());
|
||||||
if (IsContained(rectBB, rotation(), dX, dY) == false)
|
if (not IsContained(rectBB, rotation(), dX, dY))
|
||||||
{
|
{
|
||||||
// put the label inside the pattern
|
// put the label inside the pattern
|
||||||
setPos(pos().x() + dX, pos().y() + dY);
|
setPos(pos().x() + dX, pos().y() + dY);
|
||||||
|
@ -693,7 +603,7 @@ void VTextGraphicsItem::UserRotateAndMove()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VTextGraphicsItem::UserMoveAndResize(const QPointF &pos)
|
void VTextGraphicsItem::UserMoveAndResize(const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (m_rectResize.contains(pos) == true)
|
if (m_rectResize.contains(pos))
|
||||||
{
|
{
|
||||||
m_eMode = mResize;
|
m_eMode = mResize;
|
||||||
setCursor(Qt::SizeFDiagCursor);
|
setCursor(Qt::SizeFDiagCursor);
|
||||||
|
@ -704,3 +614,113 @@ void VTextGraphicsItem::UserMoveAndResize(const QPointF &pos)
|
||||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTextGraphicsItem::MoveLabel(QGraphicsSceneMouseEvent *pME)
|
||||||
|
{
|
||||||
|
const QPointF ptDiff = pME->scenePos() - m_ptStart;
|
||||||
|
// in move mode move the label along the mouse move from the origin
|
||||||
|
QPointF pt = m_ptStartPos + ptDiff;
|
||||||
|
QRectF rectBB;
|
||||||
|
rectBB.setTopLeft(pt);
|
||||||
|
rectBB.setWidth(m_rectBoundingBox.width());
|
||||||
|
rectBB.setHeight(m_rectBoundingBox.height());
|
||||||
|
// before moving label to a new position, check if it will still be inside the parent item
|
||||||
|
qreal dX;
|
||||||
|
qreal dY;
|
||||||
|
if (not IsContained(rectBB, rotation(), dX, dY))
|
||||||
|
{
|
||||||
|
pt.setX(pt.x() + dX);
|
||||||
|
pt.setY(pt.y() + dY);
|
||||||
|
}
|
||||||
|
setPos(pt);
|
||||||
|
UpdateBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTextGraphicsItem::ResizeLabel(QGraphicsSceneMouseEvent *pME)
|
||||||
|
{
|
||||||
|
QLineF vectorDiff(m_ptStart, pME->scenePos());
|
||||||
|
vectorDiff.setAngle(vectorDiff.angle() + m_dRotation);
|
||||||
|
const QPointF ptDiff = vectorDiff.p2() - m_ptStart;
|
||||||
|
|
||||||
|
// in resize mode, resize the label along the mouse move from the origin
|
||||||
|
QPointF pt;
|
||||||
|
QSizeF sz;
|
||||||
|
|
||||||
|
if (m_moveType & IsMovable)
|
||||||
|
{
|
||||||
|
const qreal newWidth = m_szStart.width() + ptDiff.x();
|
||||||
|
const qreal newHeight = m_szStart.height() + ptDiff.y();
|
||||||
|
if (newWidth <= minW || newHeight <= minH)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pt = m_ptStartPos;
|
||||||
|
sz = QSizeF(newWidth, newHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const qreal newWidth = m_szStart.width() + ptDiff.x() * 2.0;
|
||||||
|
const qreal newHeight = m_szStart.height() + ptDiff.y() * 2.0;
|
||||||
|
if (newWidth <= minW || newHeight <= minH)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pt = QPointF(m_ptRotCenter.x() - newWidth / 2.0, m_ptRotCenter.y() - newHeight / 2.0);
|
||||||
|
sz = QSizeF(m_szStart.width() + ptDiff.x() * 2.0, m_szStart.height() + ptDiff.y() * 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF rectBB;
|
||||||
|
rectBB.setTopLeft(pt);
|
||||||
|
rectBB.setSize(sz);
|
||||||
|
// before resizing the label to a new size, check if it will still be inside the parent item
|
||||||
|
qreal dX;
|
||||||
|
qreal dY;
|
||||||
|
if (IsContained(rectBB, rotation(), dX, dY))
|
||||||
|
{
|
||||||
|
if (not(m_moveType & IsMovable))
|
||||||
|
{
|
||||||
|
setPos(pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSize(sz.width(), sz.height());
|
||||||
|
Update();
|
||||||
|
emit SignalShrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTextGraphicsItem::RotateLabel(QGraphicsSceneMouseEvent *pME)
|
||||||
|
{
|
||||||
|
// if the angle from the original position is small (0.5 degrees), just remeber the new angle
|
||||||
|
// new angle will be the starting angle for rotation
|
||||||
|
if (fabs(m_dAngle) < 0.01)
|
||||||
|
{
|
||||||
|
m_dAngle = GetAngle(mapToParent(pME->pos()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF rectBB;
|
||||||
|
rectBB.setTopLeft(m_ptStartPos);
|
||||||
|
rectBB.setWidth(m_rectBoundingBox.width());
|
||||||
|
rectBB.setHeight(m_rectBoundingBox.height());
|
||||||
|
|
||||||
|
// calculate the angle difference from the starting angle
|
||||||
|
double dAng = qRadiansToDegrees(GetAngle(mapToParent(pME->pos())) - m_dAngle);
|
||||||
|
|
||||||
|
// check if the rotated label will be inside the parent item and then rotate it
|
||||||
|
qreal dX;
|
||||||
|
qreal dY;
|
||||||
|
if (IsContained(rectBB, m_dRotation + dAng, dX, dY))
|
||||||
|
{
|
||||||
|
setRotation(m_dRotation + dAng);
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "vpieceitem.h"
|
|
||||||
#include "../vlayout/vtextmanager.h"
|
#include "../vlayout/vtextmanager.h"
|
||||||
|
#include "vpieceitem.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VTextGraphicsItem class. This class implements text graphics item,
|
* @brief The VTextGraphicsItem class. This class implements text graphics item,
|
||||||
|
@ -51,15 +51,19 @@
|
||||||
class VTextGraphicsItem final : public VPieceItem
|
class VTextGraphicsItem final : public VPieceItem
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VTextGraphicsItem(QGraphicsItem *pParent = nullptr);
|
explicit VTextGraphicsItem(QGraphicsItem *pParent = nullptr);
|
||||||
virtual ~VTextGraphicsItem() = default;
|
~VTextGraphicsItem() override = default;
|
||||||
|
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
virtual void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
virtual auto type() const -> int override { return Type; }
|
auto type() const -> int override { return Type; }
|
||||||
enum { Type = UserType + static_cast<int>(Vis::TextGraphicsItem)};
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Vis::TextGraphicsItem)
|
||||||
|
};
|
||||||
|
|
||||||
void SetFont(const QFont &fnt);
|
void SetFont(const QFont &fnt);
|
||||||
auto GetFontSize() const -> int;
|
auto GetFontSize() const -> int;
|
||||||
|
@ -70,11 +74,11 @@ public:
|
||||||
auto GetTextLines() const -> vsizetype;
|
auto GetTextLines() const -> vsizetype;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent* pME) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *pME) override;
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* pME) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *pME) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *pME) override;
|
||||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *pME) override;
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *pME) override;
|
||||||
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* pHE) override;
|
void hoverMoveEvent(QGraphicsSceneHoverEvent *pHE) override;
|
||||||
|
|
||||||
void UpdateBox();
|
void UpdateBox();
|
||||||
void CorrectLabel();
|
void CorrectLabel();
|
||||||
|
@ -86,17 +90,21 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VTextGraphicsItem) // NOLINT
|
Q_DISABLE_COPY_MOVE(VTextGraphicsItem) // NOLINT
|
||||||
QPointF m_ptStartPos;
|
QPointF m_ptStartPos{};
|
||||||
QPointF m_ptStart;
|
QPointF m_ptStart{};
|
||||||
QSizeF m_szStart;
|
QSizeF m_szStart{};
|
||||||
double m_dRotation;
|
double m_dRotation{0};
|
||||||
double m_dAngle;
|
double m_dAngle{0};
|
||||||
QRectF m_rectResize;
|
QRectF m_rectResize{};
|
||||||
VTextManager m_tm;
|
VTextManager m_tm{};
|
||||||
|
|
||||||
void AllUserModifications(const QPointF &pos);
|
void AllUserModifications(const QPointF &pos);
|
||||||
void UserRotateAndMove();
|
void UserRotateAndMove();
|
||||||
void UserMoveAndResize(const QPointF &pos);
|
void UserMoveAndResize(const QPointF &pos);
|
||||||
|
|
||||||
|
void MoveLabel(QGraphicsSceneMouseEvent *pME);
|
||||||
|
void ResizeLabel(QGraphicsSceneMouseEvent *pME);
|
||||||
|
void RotateLabel(QGraphicsSceneMouseEvent *pME);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTEXTGRAPHICSITEM_H
|
#endif // VTEXTGRAPHICSITEM_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user