61 #include "../dialogs/tools/piece/pattern_piece_dialog.h"
62 #include "../ifc/xml/vpatternconverter.h"
63 #include "../vgeometry/varc.h"
64 #include "../vgeometry/vellipticalarc.h"
65 #include "../vgeometry/vcubicbezier.h"
66 #include "../vgeometry/vcubicbezierpath.h"
67 #include "../vgeometry/vpointf.h"
68 #include "../vgeometry/vspline.h"
69 #include "../vgeometry/vsplinepath.h"
70 #include "../vpatterndb/vpiecenode.h"
71 #include "../vpatterndb/vpiecepath.h"
72 #include "../vpatterndb/calculator.h"
73 #include "../vpatterndb/floatItemData/vpatternlabeldata.h"
74 #include "../vpatterndb/floatItemData/vpiecelabeldata.h"
75 #include "../vpatterndb/floatItemData/vgrainlinedata.h"
76 #include "../qmuparser/qmutokenparser.h"
77 #include "../undocommands/addpiece.h"
78 #include "../undocommands/deletepiece.h"
79 #include "../undocommands/movepiece.h"
80 #include "../undocommands/savepieceoptions.h"
81 #include "../undocommands/togglepieceinlayout.h"
82 #include "../undocommands/toggle_piecelock.h"
83 #include "../vwidgets/vabstractmainwindow.h"
84 #include "../vwidgets/vmaingraphicsview.h"
85 #include "../vwidgets/nonscalingfill_pathitem.h"
87 #include <QGraphicsScene>
88 #include <QGraphicsSceneMouseEvent>
89 #include <QGraphicsView>
90 #include <QInputDialog>
93 #include <QMessageBox>
94 #include <QPainterPathStroker>
129 VPiece piece = dialogTool->GetPiece();
130 QString width = piece.getSeamAllowanceWidthFormula();
131 qApp->getUndoStack()->beginMacro(
"add pattern piece");
137 if (patternPiece !=
nullptr)
139 patternPiece->
m_dialog = dialogTool;
147 const Source &typeCreation,
const QString &blockName)
152 width,
true, tr(
"Current seam allowance")));
161 width,
true, tr(
"Current seam allowance")));
175 scene->addItem(patternPiece);
211 if (pieceId >
NULL_ID && !nodes.isEmpty())
223 VPiece newPiece = oldPiece;
225 for (
auto node : nodes)
244 qApp->getUndoStack()->push(saveCommand);
293 domElement.appendChild(recordNode);
300 if (records.size() > 0)
303 for (
int i = 0; i < records.size(); ++i)
307 domElement.appendChild(csaRecordsElement);
314 if (paths.size() > 0)
317 for (
int i = 0; i < paths.size(); ++i)
321 iPathsElement.appendChild(recordNode);
323 domElement.appendChild(iPathsElement);
330 if (anchors.size() > 0)
333 for (
int i = 0; i < anchors.size(); ++i)
336 recordNode.appendChild(
doc->createTextNode(QString().setNum(anchors.at(i))));
337 anchorsElement.appendChild(recordNode);
339 domElement.appendChild(anchorsElement);
393 domElement.appendChild(domData);
436 domElement.appendChild(domData);
479 domElement.appendChild(domData);
511 setFlag(QGraphicsItem::ItemIsMovable, move);
512 m_grainLine->setFlag(QGraphicsItem::ItemIsMovable, move);
513 m_dataLabel->setFlag(QGraphicsItem::ItemIsMovable, move);
517 for (
int i = 0; i< piece.
GetPath().CountNodes(); ++i)
535 setFlag(QGraphicsItem::ItemIsMovable, lock);
536 m_grainLine->setFlag(QGraphicsItem::ItemIsMovable, lock);
537 m_dataLabel->setFlag(QGraphicsItem::ItemIsMovable, lock);
541 for (
int i = 0; i< piece.
GetPath().CountNodes(); ++i)
557 setAcceptHoverEvents(enabled);
563 setFlag(QGraphicsItem::ItemIsSelectable, enabled);
569 const bool selected = isSelected();
586 VGrainlineItem *pGLI = qgraphicsitem_cast<VGrainlineItem*>(pItem);
595 setSelected(selected);
616 setSelected(
m_id ==
id);
634 qDebug() <<
"Update Piece label: " << piece.
GetName();
640 qreal labelAngle = 0;
661 qDebug() <<
"Update Pattern label: " << piece.
GetName();
664 if (
data.IsVisible() &
qApp->Settings()->showLabels())
667 qreal labelAngle = 0;
690 qDebug()<<
"Update Grainline IsVisible() = "<<
data.IsVisible();
692 if (
data.IsVisible() &
qApp->Settings()->showGrainlines())
707 data.GetArrowType());
723 VPiece newPiece = oldPiece;
727 moveCommand->setText(tr(
"move pattern piece label"));
729 qApp->getUndoStack()->push(moveCommand);
739 VPiece newPiece = oldPiece;
748 resizeCommand->setText(tr(
"resize pattern piece label"));
750 qApp->getUndoStack()->push(resizeCommand);
760 VPiece newPiece = oldPiece;
765 QLineF line(0, 0, 100, 0);
766 line.setAngle(-dRot);
770 rotateCommand->setText(tr(
"rotate pattern piece label"));
772 qApp->getUndoStack()->push(rotateCommand);
783 VPiece newPiece = oldPiece;
787 moveCommand->setText(tr(
"move pattern info label"));
789 qApp->getUndoStack()->push(moveCommand);
799 VPiece newPiece = oldPiece;
808 resizeCommand->setText(tr(
"resize pattern info label"));
810 qApp->getUndoStack()->push(resizeCommand);
817 VPiece newPiece = oldPiece;
823 QLineF line(0, 0, 100, 0);
824 line.setAngle(-dRot);
828 rotateCommand->setText(tr(
"rotate pattern info label"));
830 qApp->getUndoStack()->push(rotateCommand);
838 VPiece newPiece = oldPiece;
840 qDebug() <<
"******* new grainline pos" << ptPos;
843 moveCommand->setText(tr(
"move grainline"));
845 qApp->getUndoStack()->push(moveCommand);
852 VPiece newPiece = oldPiece;
858 resizeCommand->setText(tr(
"resize grainline"));
860 qApp->getUndoStack()->push(resizeCommand);
867 VPiece newPiece = oldPiece;
872 rotateCommand->setText(tr(
"rotate grainline"));
874 qApp->getUndoStack()->push(rotateCommand);
888 color = QColor(
qApp->Settings()->getDefaultCutColor());
889 lineType =
qApp->Settings()->getDefaultCutLinetype();
899 if (
qApp->Settings()->showSeamAllowances())
903 color = QColor(
qApp->Settings()->getDefaultSeamColor());
904 lineType =
qApp->Settings()->getDefaultSeamLinetype();
909 color = QColor(
qApp->Settings()->getDefaultCutColor());
910 lineType =
qApp->Settings()->getDefaultCutLinetype();
917 QBrush brush = QBrush(QColor(piece.
getColor()));
918 brush.setStyle(
static_cast<Qt::BrushStyle
>(
fills().indexOf(QRegExp(piece.
getFill()))));
919 brush.setTransform(brush.transform().scale(150.0, 150.0));
920 brush.setTransform(painter->combinedTransform().inverted());
922 this->setBrush(brush);
926 color = QColor(
qApp->Settings()->getDefaultNotchColor());
928 Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
937 QGraphicsPathItem::paint(painter, option, widget);
945 return QGraphicsPathItem::boundingRect();
958 return QGraphicsPathItem::shape();
987 qApp->getUndoStack()->push(cmd);
994 if (domElement.isElement())
1000 "Time to refactor the code.");
1025 if (change == ItemPositionChange && scene())
1029 static bool changeFinished =
true;
1032 changeFinished =
false;
1035 const QPointF newPos = value.toPointF();
1039 qApp->getUndoStack()->push(cmd);
1042 if (not viewList.isEmpty())
1044 if (
VMainGraphicsView *view = qobject_cast<VMainGraphicsView *>(viewList.at(0)))
1047 const int xmargin = 50;
1048 const int ymargin = 50;
1051 const QRectF itemRect = mapToScene(
boundingRect()|childrenBoundingRect()).boundingRect();
1054 if (itemRect.height() + 2*ymargin < viewRect.height() &&
1055 itemRect.width() + 2*xmargin < viewRect.width())
1057 view->ensureVisible(itemRect, xmargin, ymargin);
1064 const QPointF cursorPosition = currentScene->
getScenePos();
1065 view->ensureVisible(QRectF(cursorPosition.x()-5/scale, cursorPosition.y()-5/scale,
1066 10/scale, 10/scale));
1073 piece.
SetMx(newPos.x());
1074 piece.
SetMy(newPos.y());
1079 changeFinished =
true;
1083 if (change == QGraphicsItem::ItemSelectedChange)
1096 return QGraphicsPathItem::itemChange(change, value);
1103 QGraphicsPathItem::mousePressEvent(event);
1106 if (not (flags() & ItemIsSelectable) && scene())
1108 scene()->clearSelection();
1111 if (flags() & QGraphicsItem::ItemIsMovable)
1113 if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
1119 if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
1131 if (event->button() == Qt::LeftButton)
1135 QGraphicsPathItem::mouseReleaseEvent(event);
1141 if (flags() & QGraphicsItem::ItemIsMovable)
1145 QGraphicsPathItem::hoverEnterEvent(event);
1152 if (flags() & QGraphicsItem::ItemIsMovable)
1154 setCursor(QCursor());
1156 QGraphicsPathItem::hoverLeaveEvent(event);
1171 QAction *editProperties = menu.addAction(QIcon::fromTheme(
"preferences-other"), tr(
"Properties") +
"\tP");
1172 editProperties->setEnabled(lock);
1174 QAction *actionLockPiece = menu.addAction(tr(
"Lock Pattern Piece") +
"\tCtrl + L");
1175 actionLockPiece->setCheckable(
true);
1176 actionLockPiece->setChecked(piece.
isLocked());
1178 QAction *separator =
new QAction(
this);
1179 separator->setSeparator(
true);
1180 menu.addAction(separator);
1182 QAction *inLayoutOption = menu.addAction(tr(
"Include in Layout") +
"\tI");
1183 inLayoutOption->setCheckable(
true);
1184 inLayoutOption->setChecked(piece.
isInLayout());
1185 inLayoutOption->setEnabled(lock);
1187 QAction *forbidFlipping = menu.addAction(tr(
"Forbid Flipping") +
"\tF");
1188 forbidFlipping->setCheckable(
true);
1190 forbidFlipping->setEnabled(lock);
1192 separator =
new QAction(
this);
1193 separator->setSeparator(
true);
1194 menu.addAction(separator);
1196 QAction *raiseToTop = menu.addAction(tr(
"Raise to top") +
"\tCtrl + Home");
1197 QAction *lowerToBottom = menu.addAction(tr(
"Lower to bottom") +
"\tCtrl + End");
1199 separator =
new QAction(
this);
1200 separator->setSeparator(
true);
1201 menu.addAction(separator);
1203 QAction *hideMainPath = menu.addAction(tr(
"Hide Seam Line") +
"\t|");
1204 hideMainPath->setCheckable(
true);
1206 hideMainPath->setEnabled(piece.
IsSeamAllowance() &&
qApp->Settings()->showSeamAllowances());
1208 QAction *showSeamAllowance = menu.addAction(QIcon(
"://icon/32x32/seam_allowance.png"),
1209 tr(
"Show Seam Allowance") +
"\tS");
1210 showSeamAllowance->setCheckable(
true);
1213 QAction *showGrainline = menu.addAction(QIcon(
"://icon/32x32/grainline.png"), tr(
"Show Grainline") +
"\tG");
1214 showGrainline->setCheckable(
true);
1218 QAction *showPatternLabel = menu.addAction(QIcon(
"://icon/32x32/pattern_label.png"), tr(
"Show Pattern Label") +
"\t[");
1219 showPatternLabel->setCheckable(
true);
1222 QAction *showPieceLabel = menu.addAction(QIcon(
"://icon/32x32/piece_label.png"), tr(
"Show Piece Label") +
"\t]");
1223 showPieceLabel->setCheckable(
true);
1226 separator =
new QAction(
this);
1227 separator->setSeparator(
true);
1228 menu.addAction(separator);
1230 QAction *rename = menu.addAction(tr(
"Rename...") +
"\tF2");
1231 rename->setEnabled(lock);
1233 QAction *deletePiece = menu.addAction(QIcon::fromTheme(
"edit-delete"), tr(
"Delete") +
"\tDel");
1234 _referens > 1 ? deletePiece->setEnabled(
false) : deletePiece->setEnabled(
true);
1235 deletePiece->setEnabled(lock);
1237 QAction *selectedAction = menu.exec(event->screenPos());
1238 if (selectedAction == editProperties)
1242 else if (selectedAction == actionLockPiece)
1246 else if (selectedAction == inLayoutOption)
1250 else if (selectedAction == forbidFlipping)
1254 else if (selectedAction == raiseToTop)
1258 else if (selectedAction == lowerToBottom)
1262 else if (selectedAction == hideMainPath)
1266 else if (selectedAction == showSeamAllowance)
1270 else if (selectedAction == showGrainline)
1274 else if (selectedAction == showPatternLabel)
1278 else if (selectedAction == showPieceLabel)
1282 else if (selectedAction == rename)
1286 else if (selectedAction == deletePiece)
1305 switch (event->key())
1307 case Qt::Key_Delete:
1333 if (event->modifiers() & Qt::ControlModifier)
1379 case Qt::Key_BracketLeft:
1385 case Qt::Key_BracketRight:
1401 if (event->modifiers() & Qt::ControlModifier)
1409 if (event->modifiers() & Qt::ControlModifier)
1419 QGraphicsPathItem::keyReleaseEvent(event);
1429 dialogTool->enableApply(
true);
1435 const QString &blockName, QGraphicsItem *parent)
1437 , QGraphicsPathItem(parent)
1441 , m_pieceScene(scene)
1442 , m_blockName(blockName)
1448 , m_notches(new QGraphicsPathItem(this))
1456 this->setFlag(QGraphicsItem::ItemIsSelectable,
true);
1459 this->setFlag(QGraphicsItem::ItemSendsGeometryChanges,
true);
1460 this->setFlag(QGraphicsItem::ItemIsFocusable,
true);
1465 setAcceptHoverEvents(
true);
1492 for (
int i = 0; i< piece.
GetPath().CountNodes(); ++i)
1509 this->setFlag(QGraphicsItem::ItemSendsGeometryChanges,
false);
1510 m_cutLine->setFlag(QGraphicsItem::ItemStacksBehindParent,
true);
1520 m_cutLine->setBrush(QBrush(QColor(
qApp->Settings()->getDefaultCutColor()), Qt::Dense7Pattern));
1525 path = QPainterPath();
1527 m_cutLine->setBrush(QBrush(Qt::NoBrush));
1530 this->setPath(path);
1544 path.setFillRule(Qt::OddEvenFill);
1563 this->setFlag(QGraphicsItem::ItemSendsGeometryChanges,
true);
1577 qApp->getUndoStack()->push(saveCommand);
1583 qreal &labelWidth, qreal &labelHeight, QPointF &pos)
1585 qDebug() <<
"Find label Geometery";
1606 if (topLeftAnchorPoint !=
NULL_ID && bottomRightAnchorPoint !=
NULL_ID)
1613 const QRectF labelRect = QRectF(
static_cast<QPointF
>(*topLeftAnchorPointPoint),
1614 static_cast<QPointF
>(*bottomRightAnchorPointPoint));
1618 pos = labelRect.topLeft();
1623 return restrictions;
1637 qDebug() <<
" Label width: " << labelWidth;
1638 qDebug() <<
" Label width is single: " << widthIsSingle;
1643 qDebug() <<
" Label height: " << labelHeight;
1644 qDebug() <<
" Label height is single: " << heightIsSingle;
1645 if (not widthIsSingle || not heightIsSingle)
1662 qDebug() <<
" Anchor center point: " << centerAnchorPoint;
1665 qDebug() <<
" Label pixel width: " << lWidth;
1666 qDebug() <<
" Label pixel height: " << lHeight;
1667 pos =
static_cast<QPointF
>(*centerAnchorPoint) - QRectF(0, 0, lWidth, lHeight).center();
1668 qDebug() <<
" Anchor point position: " << pos;
1673 pos = labelData.
GetPos();
1678 pos = labelData.
GetPos();
1681 return restrictions;
1686 qreal &rotationAngle, QPointF &pos)
1688 const quint32 topAnchorPoint =
data.topAnchorPoint();
1689 const quint32 bottomAnchorPoint =
data.bottomAnchorPoint();
1698 QLineF grainline(
static_cast<QPointF
>(*bottomAnchor_Point),
static_cast<QPointF
>(*topAnchor_Point));
1700 rotationAngle = grainline.angle();
1704 grainline.setAngle(0);
1707 pos = grainline.p1();
1742 const quint32 centerAnchor =
data.centerAnchorPoint();
1750 QLineF grainline(centerAnchorPoint->x(), centerAnchorPoint->y(),
1751 centerAnchorPoint->x() + cLength / 2.0, centerAnchorPoint->y());
1753 grainline.setAngle(rotationAngle);
1754 grainline = QLineF(grainline.p2(), grainline.p1());
1755 grainline.setLength(cLength);
1757 pos = grainline.p2();
1762 pos =
data.GetPos();
1767 pos =
data.GetPos();
1770 return restrictions;
1776 for (
int i = 0; i< piece.
GetPath().CountNodes(); ++i)
1799 tool->setParentItem(parent);
1813 qDebug()<<
"Get wrong tool type. Ignore.";
1831 for (
int i = 0; i < pathIds.size(); ++i)
1837 color = QColor(
qApp->Settings()->getDefaultCutoutColor());
1841 color = QColor(
qApp->Settings()->getDefaultInternalColor());
1848 tool->setParentItem(
this);
1850 tool->setPen(QPen(color,
scaleWidth(lineWeight,
sceneScale(scene())), lineType, Qt::RoundCap, Qt::RoundJoin));
1859 for (
int i = 0; i < piece.
getAnchors().size(); ++i)
1883 disconnect(
doc,
nullptr,
this,
nullptr);
1884 if (QGraphicsScene *toolScene = scene())
1886 disconnect(toolScene,
nullptr,
this,
nullptr);
1895 qApp->getUndoStack()->push(cmd.take());
1910 qApp->getUndoStack()->endMacro();
1921 QPointF &pos, qreal &labelAngle)
1925 qDebug() <<
"Prepare Label Data";
1927 qreal labelWidth = 0;
1928 qreal labelHeight = 0;
1929 const VTextGraphicsItem::MoveTypes
type =
FindLabelGeometry(labelData, labelAngle, labelWidth, labelHeight, pos);
1937 QFont fnt =
qApp->Settings()->getLabelFont();
1940 qDebug() <<
" Label Font Size = " << iFS;
1947 qDebug() <<
" Label Font Pixel Size = " << iFS;
1963 rectBB.setTopLeft(pos);
1968 if (labelItem->
isContained(rectBB, labelAngle, dX, dY) ==
false)
1970 pos.setX(pos.x() + dX);
1971 pos.setY(pos.y() + dY);
1974 labelItem->setPos(pos);
1975 labelItem->setRotation(-labelAngle);
1977 labelItem->
getTextLines() > 0 ? labelItem->show() : labelItem->hide();
1987 dialog->enableApply(
true);
2004 qApp->getUndoStack()->push(cmd);
2015 qApp->getUndoStack()->push(cmd);
2027 VPiece newPiece = oldPiece;
2031 undoCommand->setText(tr(
"Forbid Flipping"));
2033 qApp->getUndoStack()->push(undoCommand);
2035 showStatus(tr(
"Forbid Flipping changed: ") + (checked ? tr(
"Enabled") : tr(
"Disabled")));
2045 VPiece newPiece = oldPiece;
2049 undoCommand->setText(tr(
"Hide Seam Line"));
2051 qApp->getUndoStack()->push(undoCommand);
2053 showStatus(tr(
"Seam line visibility changed: ") + (checked ? tr(
"Hide") : tr(
"Show")));
2063 VPiece newPiece = oldPiece;
2067 undoCommand->setText(tr(
"Show seam allowance"));
2069 qApp->getUndoStack()->push(undoCommand);
2071 showStatus(tr(
"Seam allowance visibility changed: ") + (checked ? tr(
"Show") : tr(
"Hide")));
2081 VPiece newPiece = oldPiece;
2085 undoCommand->setText(tr(
"Show grainline"));
2087 qApp->getUndoStack()->push(undoCommand);
2089 showStatus(tr(
"Grainline visibility changed: ") + (checked ? tr(
"Show") : tr(
"Hide")));
2099 VPiece newPiece = oldPiece;
2103 undoCommand->setText(tr(
"Show pattern label"));
2105 qApp->getUndoStack()->push(undoCommand);
2107 showStatus(tr(
"Pattern label visibility changed: ") + (checked ? tr(
"Show") : tr(
"Hide")));
2117 VPiece newPiece = oldPiece;
2121 undoCommand->setText(tr(
"Show piece label"));
2123 qApp->getUndoStack()->push(undoCommand);
2125 showStatus(tr(
"Piece label visibility changed: ") + (checked ? tr(
"Show") : tr(
"Hide")));
2134 QInputDialog *dialog =
new QInputDialog(
nullptr);
2135 dialog->setInputMode( QInputDialog::TextInput );
2136 dialog->setLabelText(tr(
"Piece name:"));
2137 dialog->setTextEchoMode(QLineEdit::Normal);
2138 dialog->setWindowTitle(tr(
"Rename Pattern Piece"));
2139 dialog->setWindowIcon(QIcon());
2140 dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint
2141 & ~Qt::WindowMaximizeButtonHint
2142 & ~Qt::WindowMinimizeButtonHint);
2143 dialog->resize(300, 100);
2144 dialog->setTextValue(piece.
GetName());
2146 const bool result = dialog->exec();
2147 pieceName = dialog->textValue();
2149 if (result ==
true && !pieceName.isEmpty())
2152 VPiece newPiece = oldPiece;
2156 undoCommand->setText(tr(
"Rename pattern piece"));
2158 qApp->getUndoStack()->push(undoCommand);
2160 showStatus(tr(
"Piece renamed to: ") + pieceName);
2184 if (item !=
nullptr)
2187 if (!items.isEmpty())
2189 for (
int i = 0; i < items.count(); ++i)
2191 if (items.at(i)->parentItem() ==
nullptr)
2193 item->stackBefore(items.at(i));
The Calculator class for calculation formula.
qreal EvalFormula(const QHash< QString, QSharedPointer< VInternalVariable > > *vars, const QString &formula)
eval calculate formula.
void updateList(quint32 m_id)
void updateList(quint32 m_id)
void SetVisible(bool bVisible)
void SetPos(const QPointF &ptPos)
virtual void ShowToolTip(const QString &toolTip)=0
void SetExluded(bool exluded)
void SetParentType(const ParentType &value)
void updatePieceList(quint32 id)
static const QString AttrLetter
static const QString AttrEnd
virtual void LiteParseTree(const Document &parse)=0
static const QString TagData
static const QString AttrAnnotation
static const QString AttrTilt
static const QString AttrRotation
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
static const QString AttrFoldPosition
static const QString AttrStart
static const QString AttrOnFold
virtual void IncrementReferens(quint32 id) const =0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
static const QString AttrWidth
static const QString AttrPath
static const QString TagPatternInfo
static const QString AttrQuantity
static const QString AttrRotationWay
void UpdatePatternLabel()
static const QString AttrOrientation
void selectedPiece(quint32 id)
static VDataTool * getTool(quint32 id)
getTool return tool from tool list.
static const QString AttrArrows
static const QString AttrIncludeAs
static const QString AttrNodeReverse
static const QString TagPiece
static const QString TagGrainline
static const QString AttrVisible
bool IsSeamAllowanceBuiltIn() const
bool IsSeamAllowance() const
bool isHideSeamLine() const
void SetForbidFlipping(bool value)
void setHideSeamLine(bool value)
void SetName(const QString &value)
void SetSeamAllowance(bool value)
bool IsForbidFlipping() const
The VContainer class container of all variables.
void AddVariable(const QString &name, T *var)
void UpdatePiece(quint32 id, const VPiece &piece)
void RemoveVariable(const QString &name)
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
quint32 AddPiece(const VPiece &piece)
const QSharedPointer< T > GeometricObject(const quint32 &id) const
VPiecePath GetPiecePath(quint32 id) const
const Unit * GetPatternUnit() const
VPiece GetPiece(quint32 id) const
QDomElement elementById(quint32 id, const QString &tagName=QString())
void SetLabelTemplate(QDomElement &element, const QVector< VLabelTemplateLine > &lines)
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
static const QString AttrId
static void RemoveAllChildren(QDomElement &domElement)
RemoveAllChildren remove all children from file.
The VExceptionBadId class for exception bad id.
The VGrainlineData class holds information about a grainline like position, size, rotation and visibi...
void SetRotation(const QString &qsRot)
void SetLength(const QString &qsLen)
void itemResized(qreal dLength)
void UpdateGeometry(const QPointF &ptPos, qreal dRotation, qreal dLength, ArrowType eAT)
VGrainlineItem::UpdateGeometry updates the item with grainline parameters.
void itemRotated(qreal dRot, const QPointF &ptNewPos)
The VIncrement class keep data row of increment table.
The VMainGraphicsScene class main scene.
void chosenItem(quint32 id, const SceneObject &type)
chosenItem emit ChosenObject signal.
QPointF getScenePos() const
void ItemClicked(QGraphicsItem *pItem)
void EnableDetailItemHover(bool enabled)
void EnableDetailItemSelection(bool enabled)
void EnableToolMove(bool move)
void pieceLockedChanged(quint32 id, bool lock)
void highlightPiece(quint32 id)
The VMainGraphicsView class main scene view.
static QRectF SceneVisibleArea(QGraphicsView *view)
The VNodePoint class point detail node.
void EnableToolMove(bool move)
static Q_DECL_CONSTEXPR const int PatternMinVer
The VPatternLabelData class holds the information about pattern info label geometry.
void SetLabelHeight(const QString &dLabelH)
void SetFontSize(int iSize)
quint32 centerAnchorPoint() const
void SetRotation(const QString &dRot)
quint32 topLeftAnchorPoint() const
QString GetLabelWidth() const
void SetLabelWidth(const QString &dLabelW)
QString GetRotation() const
quint32 bottomRightAnchorPoint() const
QString GetLabelHeight() const
bool IsIdle() const
IsIdle returns the idle flag.
virtual QRectF boundingRect() const Q_DECL_OVERRIDE
boundingRect returns the item bounding box
void itemMoved(const QPointF &ptPos)
void Reset()
Reset resets the item, putting the mode and z coordinate to normal and redraws it.
void SetMoveType(const VPieceItem::MoveTypes &moveType)
The VPieceLabelData class holds some information about a single piece like letter,...
void Append(const VPieceNode &node)
Qt::PenStyle GetPenType() const
const VPieceNode & at(int indx) const
QPainterPath SeamAllowancePath(const VContainer *data) const
VPieceLabelData & GetPatternPieceData()
Returns full access to the pattern piece data object.
QVector< CustomSARecord > GetCustomSARecords() const
QString getSeamAllowanceWidthFormula() const
QPainterPath getNotchesPath(const VContainer *data, const QVector< QPointF > &seamAllowance=QVector< QPointF >()) const
QVector< quint32 > GetInternalPaths() const
QVector< quint32 > getAnchors() const
QVector< QPointF > SeamAllowancePoints(const VContainer *data) const
QPainterPath MainPathPath(const VContainer *data) const
void setSeamAllowanceWidthFormula(const QString &formula, qreal value)
VGrainlineData & GetGrainlineGeometry()
VDetail::GetGrainlineGeometry full access to the grainline geometry object.
VPatternLabelData & GetPatternInfo()
Returns full access to the pattern info geometry object.
VPiecePath GetPath() const
The VPointF class keep data of point.
The VTextGraphicsItem class. This class implements text graphics item, which can be dragged around,...
void itemRotated(qreal angle)
void itemResized(qreal width, int fontSize)
int getFontSize() const
VTextGraphicsItem::getFontSize returns the currentextLiney used text base font size.
int getTextLines() const
VTextGraphicsItem::getTextLines returns the number of lines of text to show.
void updateData(const QString &name, const VPieceLabelData &data)
VTextGraphicsItem::updateData Updates the detail label.
void setFont(const QFont &font)
VTextGraphicsItem::SetFont sets the item font.
void setSize(qreal width, qreal height)
VTextGraphicsItem::setSize Tries to set the label size to (width, height). If either of those is too ...
virtual void Update() Q_DECL_OVERRIDE
VTextGraphicsItem::Update sets the correct size and font size and redraws the label.
bool isContained(QRectF rectBB, qreal rotation, qreal &xPos, qreal &yPos) const
VTextGraphicsItem::isContained checks if the bounding box around rotated rectBB is contained in the p...
void NeedLiteParsing(const Document &parse)
Error class of the parser.
static bool IsSingle(const QString &formula)
IsSingle test formula and return true if it contain only one number.
const QString cursorArrowOpenHand
double ToPixel(double val, const Unit &unit)
void SetItemOverrideCursor(QGraphicsItem *item, const QString &pixmapPath, int hotX, int hotY)
const QString cursorArrowCloseHand
double FromPixel(double pix, const Unit &unit)
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
qreal sceneScale(QGraphicsScene *scene)
QPainterPath ItemShapeFromPath(const QPainterPath &path, const QPen &pen)
qreal scaleWidth(qreal width, qreal scale)
const QString currentSeamAllowance
const QString AttrPieceLocked
const QString AttrInLayout
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.
The CustomSA struct contains record about custom seam allowanse (SA).
PiecePathIncludeType includeType
#define CONVERTER_VERSION_CHECK(major, minor, patch)