parent
3df6c09934
commit
29b23bbce3
|
@ -2110,7 +2110,7 @@ void MainWindow::CancelTool()
|
||||||
// https://bitbucket.org/dismine/valentina/issues/454/crash-using-crtl-z-while-using-line-tool
|
// https://bitbucket.org/dismine/valentina/issues/454/crash-using-crtl-z-while-using-line-tool
|
||||||
undoAction->setEnabled(false);
|
undoAction->setEnabled(false);
|
||||||
redoAction->setEnabled(false);
|
redoAction->setEnabled(false);
|
||||||
VInteractiveTool::m_suppressContextMenu = true;
|
VAbstractTool::m_suppressContextMenu = true;
|
||||||
return;
|
return;
|
||||||
case Tool::BasePoint:
|
case Tool::BasePoint:
|
||||||
case Tool::SinglePoint:
|
case Tool::SinglePoint:
|
||||||
|
@ -2282,7 +2282,7 @@ void MainWindow::ArrowTool()
|
||||||
currentTool = Tool::Arrow;
|
currentTool = Tool::Arrow;
|
||||||
emit EnableItemMove(true);
|
emit EnableItemMove(true);
|
||||||
emit ItemsSelection(SelectionType::ByMouseRelease);
|
emit ItemsSelection(SelectionType::ByMouseRelease);
|
||||||
VInteractiveTool::m_suppressContextMenu = false;
|
VAbstractTool::m_suppressContextMenu = false;
|
||||||
|
|
||||||
// Only true for rubber band selection
|
// Only true for rubber band selection
|
||||||
emit EnableLabelSelection(true);
|
emit EnableLabelSelection(true);
|
||||||
|
|
|
@ -1665,9 +1665,12 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
|
||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
return;// Just ignore
|
return;// Just ignore
|
||||||
}
|
}
|
||||||
initData.data->UpdateGObject(initData.id,
|
|
||||||
new VPointF(static_cast<QPointF>(*point), point->name(), mx, my, initData.idObject,
|
QSharedPointer<VPointF> p(new VPointF(static_cast<QPointF>(*point), point->name(), mx, my, initData.idObject,
|
||||||
Draw::Modeling));
|
Draw::Modeling));
|
||||||
|
p->SetShowLabel(GetParametrBool(domElement, AttrShowLabel, trueStr));
|
||||||
|
|
||||||
|
initData.data->UpdateGObject(initData.id, p);
|
||||||
VNodePoint::Create(initData);
|
VNodePoint::Create(initData);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
<file>schema/pattern/v0.6.5.xsd</file>
|
<file>schema/pattern/v0.6.5.xsd</file>
|
||||||
<file>schema/pattern/v0.6.6.xsd</file>
|
<file>schema/pattern/v0.6.6.xsd</file>
|
||||||
<file>schema/pattern/v0.7.0.xsd</file>
|
<file>schema/pattern/v0.7.0.xsd</file>
|
||||||
|
<file>schema/pattern/v0.7.1.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||||
|
|
1043
src/libs/ifc/schema/pattern/v0.7.1.xsd
Normal file
1043
src/libs/ifc/schema/pattern/v0.7.1.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -58,8 +58,8 @@ class QDomElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.0");
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.1");
|
||||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.0.xsd");
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.1.xsd");
|
||||||
|
|
||||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
@ -258,6 +258,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
||||||
case (0x000606):
|
case (0x000606):
|
||||||
return QStringLiteral("://schema/pattern/v0.6.6.xsd");
|
return QStringLiteral("://schema/pattern/v0.6.6.xsd");
|
||||||
case (0x000700):
|
case (0x000700):
|
||||||
|
return QStringLiteral("://schema/pattern/v0.7.0.xsd");
|
||||||
|
case (0x000701):
|
||||||
return CurrentSchema;
|
return CurrentSchema;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(ver);
|
InvalidVersion(ver);
|
||||||
|
@ -434,6 +436,10 @@ void VPatternConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(0x000700), m_convertedFileName);
|
ValidateXML(XSDSchema(0x000700), m_convertedFileName);
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000700):
|
case (0x000700):
|
||||||
|
ToV0_7_1();
|
||||||
|
ValidateXML(XSDSchema(0x000701), m_convertedFileName);
|
||||||
|
V_FALLTHROUGH
|
||||||
|
case (0x000701):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
|
@ -451,7 +457,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
||||||
bool VPatternConverter::IsReadOnly() const
|
bool VPatternConverter::IsReadOnly() const
|
||||||
{
|
{
|
||||||
// Check if attribute readOnly was not changed in file format
|
// Check if attribute readOnly was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 1),
|
||||||
"Check attribute readOnly.");
|
"Check attribute readOnly.");
|
||||||
|
|
||||||
// Possibly in future attribute readOnly will change position etc.
|
// Possibly in future attribute readOnly will change position etc.
|
||||||
|
@ -925,6 +931,16 @@ void VPatternConverter::ToV0_7_0()
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternConverter::ToV0_7_1()
|
||||||
|
{
|
||||||
|
// TODO. Delete if minimal supported version is 0.7.1
|
||||||
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 1),
|
||||||
|
"Time to refactor the code.");
|
||||||
|
SetVersion(QStringLiteral("0.7.1"));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPatternConverter::TagUnitToV0_2_0()
|
void VPatternConverter::TagUnitToV0_2_0()
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
static const QString PatternMaxVerStr;
|
static const QString PatternMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 0);
|
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 1);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int MinVer() const Q_DECL_OVERRIDE;
|
virtual int MinVer() const Q_DECL_OVERRIDE;
|
||||||
|
@ -113,6 +113,7 @@ private:
|
||||||
void ToV0_6_5();
|
void ToV0_6_5();
|
||||||
void ToV0_6_6();
|
void ToV0_6_6();
|
||||||
void ToV0_7_0();
|
void ToV0_7_0();
|
||||||
|
void ToV0_7_1();
|
||||||
|
|
||||||
void TagUnitToV0_2_0();
|
void TagUnitToV0_2_0();
|
||||||
void TagIncrementToV0_2_0();
|
void TagIncrementToV0_2_0();
|
||||||
|
|
|
@ -100,7 +100,7 @@ void VAbstractOperation::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
point->setMy(pos.y());
|
point->setMy(pos.y());
|
||||||
item->RefreshPointGeometry(*(point.data()));
|
item->RefreshPointGeometry(*(point.data()));
|
||||||
|
|
||||||
if (QGraphicsScene *sc = scene())
|
if (QGraphicsScene *sc = item->scene())
|
||||||
{
|
{
|
||||||
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), item);
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), item);
|
||||||
}
|
}
|
||||||
|
@ -136,6 +136,10 @@ void VAbstractOperation::SetLabelVisible(quint32 id, bool visible)
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
point->SetShowLabel(visible);
|
point->SetShowLabel(visible);
|
||||||
item->RefreshPointGeometry(*point);
|
item->RefreshPointGeometry(*point);
|
||||||
|
if (QGraphicsScene *sc = item->scene())
|
||||||
|
{
|
||||||
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,12 +147,20 @@ void VToolDoublePoint::SetLabelVisible(quint32 id, bool visible)
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p1id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p1id);
|
||||||
point->SetShowLabel(visible);
|
point->SetShowLabel(visible);
|
||||||
firstPoint->RefreshPointGeometry(*point);
|
firstPoint->RefreshPointGeometry(*point);
|
||||||
|
if (QGraphicsScene *sc = firstPoint->scene())
|
||||||
|
{
|
||||||
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), firstPoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (p2id == id)
|
else if (p2id == id)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p2id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p2id);
|
||||||
point->SetShowLabel(visible);
|
point->SetShowLabel(visible);
|
||||||
secondPoint->RefreshPointGeometry(*point);
|
secondPoint->RefreshPointGeometry(*point);
|
||||||
|
if (QGraphicsScene *sc = secondPoint->scene())
|
||||||
|
{
|
||||||
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), secondPoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +237,7 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
point->setMy(pos.y());
|
point->setMy(pos.y());
|
||||||
firstPoint->RefreshPointGeometry(*(point.data()));
|
firstPoint->RefreshPointGeometry(*(point.data()));
|
||||||
|
|
||||||
if (QGraphicsScene *sc = scene())
|
if (QGraphicsScene *sc = firstPoint->scene())
|
||||||
{
|
{
|
||||||
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), firstPoint);
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), firstPoint);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +249,7 @@ void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
point->setMy(pos.y());
|
point->setMy(pos.y());
|
||||||
secondPoint->RefreshPointGeometry(*(point.data()));
|
secondPoint->RefreshPointGeometry(*(point.data()));
|
||||||
|
|
||||||
if (QGraphicsScene *sc = scene())
|
if (QGraphicsScene *sc = secondPoint->scene())
|
||||||
{
|
{
|
||||||
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), secondPoint);
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), secondPoint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,10 @@ void VToolSinglePoint::SetLabelVisible(quint32 id, bool visible)
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
point->SetShowLabel(visible);
|
point->SetShowLabel(visible);
|
||||||
RefreshPointGeometry(*point);
|
RefreshPointGeometry(*point);
|
||||||
|
if (QGraphicsScene *sc = scene())
|
||||||
|
{
|
||||||
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,10 +262,3 @@ bool VDrawTool::IsLabelVisible(quint32 id) const
|
||||||
Q_UNUSED(id)
|
Q_UNUSED(id)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VDrawTool::SetLabelVisible(quint32 id, bool visible)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id)
|
|
||||||
Q_UNUSED(visible)
|
|
||||||
}
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ public:
|
||||||
virtual void SetTypeLine(const QString &value);
|
virtual void SetTypeLine(const QString &value);
|
||||||
|
|
||||||
virtual bool IsLabelVisible(quint32 id) const;
|
virtual bool IsLabelVisible(quint32 id) const;
|
||||||
virtual void SetLabelVisible(quint32 id, bool visible);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ChangedToolSelection(bool selected, quint32 object, quint32 tool);
|
void ChangedToolSelection(bool selected, quint32 object, quint32 tool);
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include <QGraphicsLineItem>
|
#include <QGraphicsLineItem>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QMenu>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
@ -56,6 +58,8 @@
|
||||||
#include "../vdatatool.h"
|
#include "../vdatatool.h"
|
||||||
#include "vabstractnode.h"
|
#include "vabstractnode.h"
|
||||||
#include "../../undocommands/label/movelabel.h"
|
#include "../../undocommands/label/movelabel.h"
|
||||||
|
#include "../../undocommands/label/showlabel.h"
|
||||||
|
#include "../vtoolseamallowance.h"
|
||||||
|
|
||||||
const QString VNodePoint::ToolType = QStringLiteral("modeling");
|
const QString VNodePoint::ToolType = QStringLiteral("modeling");
|
||||||
|
|
||||||
|
@ -75,7 +79,7 @@ VNodePoint::VNodePoint(const VAbstractNodeInitData &initData, QObject *qoParent,
|
||||||
connect(m_namePoint, &VGraphicsSimpleTextItem::ShowContextMenu,
|
connect(m_namePoint, &VGraphicsSimpleTextItem::ShowContextMenu,
|
||||||
this, [this](QGraphicsSceneContextMenuEvent *event)
|
this, [this](QGraphicsSceneContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
emit ShowContextMenu(event);
|
contextMenuEvent(event);
|
||||||
});
|
});
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(initData.id));
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(initData.id));
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
|
@ -147,6 +151,21 @@ void VNodePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VNodePoint::SetLabelVisible(quint32 id, bool visible)
|
||||||
|
{
|
||||||
|
if (m_id == id)
|
||||||
|
{
|
||||||
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
|
point->SetShowLabel(visible);
|
||||||
|
RefreshPointGeometry(*point);
|
||||||
|
if (QGraphicsScene *sc = scene())
|
||||||
|
{
|
||||||
|
VMainGraphicsView::NewSceneRect(sc, qApp->getSceneView(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::PointChoosed()
|
void VNodePoint::PointChoosed()
|
||||||
{
|
{
|
||||||
|
@ -176,6 +195,7 @@ void VNodePoint::AddToFile()
|
||||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
doc->SetAttribute<bool>(domElement, AttrShowLabel, point->IsShowLabel());
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
|
@ -241,7 +261,55 @@ void VNodePoint::HideNode()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
emit ShowContextMenu(event);
|
if (m_suppressContextMenu)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VToolSeamAllowance *piece = qgraphicsitem_cast<VToolSeamAllowance *>(parentItem()))
|
||||||
|
{
|
||||||
|
QMenu menu;
|
||||||
|
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||||
|
|
||||||
|
QAction *inLayoutOption = menu.addAction(tr("In layout"));
|
||||||
|
inLayoutOption->setCheckable(true);
|
||||||
|
const VPiece detail = VAbstractTool::data.GetPiece(piece->getId());
|
||||||
|
inLayoutOption->setChecked(detail.IsInLayout());
|
||||||
|
|
||||||
|
QAction *actionShowLabel = menu.addAction(tr("Show label"));
|
||||||
|
actionShowLabel->setCheckable(true);
|
||||||
|
actionShowLabel->setChecked(VAbstractTool::data.GeometricObject<VPointF>(m_id)->IsShowLabel());
|
||||||
|
|
||||||
|
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
|
piece->referens() > 1 ? actionRemove->setEnabled(false) : actionRemove->setEnabled(true);
|
||||||
|
|
||||||
|
QAction *selectedAction = menu.exec(event->screenPos());
|
||||||
|
if (selectedAction == actionOption)
|
||||||
|
{
|
||||||
|
emit ShowOptions();
|
||||||
|
}
|
||||||
|
else if (selectedAction == inLayoutOption)
|
||||||
|
{
|
||||||
|
emit ToggleInLayout(selectedAction->isChecked());
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionRemove)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
emit Delete();
|
||||||
|
}
|
||||||
|
catch(const VExceptionToolWasDeleted &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e);
|
||||||
|
return;//Leave this method immediately!!!
|
||||||
|
}
|
||||||
|
//Leave this method immediately after call!!!
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionShowLabel)
|
||||||
|
{
|
||||||
|
qApp->getUndoStack()->push(new ShowLabel(doc, m_id, selectedAction->isChecked()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -58,14 +58,11 @@ public:
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
|
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
|
||||||
|
virtual void SetLabelVisible(quint32 id, bool visible) Q_DECL_OVERRIDE;
|
||||||
signals:
|
signals:
|
||||||
/**
|
void ShowOptions();
|
||||||
* @brief ShowContextMenu emit when need show tool context menu.
|
void ToggleInLayout(bool checked);
|
||||||
* @param event context menu event.
|
void Delete();
|
||||||
*/
|
|
||||||
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
||||||
void NameChangePosition(const QPointF &pos);
|
void NameChangePosition(const QPointF &pos);
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
|
||||||
|
bool VAbstractTool::m_suppressContextMenu = false;
|
||||||
const QString VAbstractTool::AttrInUse = QStringLiteral("inUse");
|
const QString VAbstractTool::AttrInUse = QStringLiteral("inUse");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -375,6 +376,13 @@ void VAbstractTool::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
Q_UNUSED(pos)
|
Q_UNUSED(pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractTool::SetLabelVisible(quint32 id, bool visible)
|
||||||
|
{
|
||||||
|
Q_UNUSED(id)
|
||||||
|
Q_UNUSED(visible)
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractTool::ToolSelectionType(const SelectionType &type)
|
void VAbstractTool::ToolSelectionType(const SelectionType &type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
virtual ~VAbstractTool() Q_DECL_OVERRIDE;
|
virtual ~VAbstractTool() Q_DECL_OVERRIDE;
|
||||||
quint32 getId() const;
|
quint32 getId() const;
|
||||||
|
|
||||||
|
static bool m_suppressContextMenu;
|
||||||
static const QString AttrInUse;
|
static const QString AttrInUse;
|
||||||
|
|
||||||
static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data);
|
static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data);
|
||||||
|
@ -109,7 +110,7 @@ public:
|
||||||
virtual QString getTagName() const =0;
|
virtual QString getTagName() const =0;
|
||||||
virtual void ShowVisualization(bool show) =0;
|
virtual void ShowVisualization(bool show) =0;
|
||||||
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos);
|
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos);
|
||||||
|
virtual void SetLabelVisible(quint32 id, bool visible);
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief FullUpdateFromFile update tool data form file.
|
* @brief FullUpdateFromFile update tool data form file.
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
#include "vinteractivetool.h"
|
#include "vinteractivetool.h"
|
||||||
|
|
||||||
bool VInteractiveTool::m_suppressContextMenu = false;
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VInteractiveTool::VInteractiveTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
VInteractiveTool::VInteractiveTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
||||||
: VAbstractTool(doc, data, id, parent),
|
: VAbstractTool(doc, data, id, parent),
|
||||||
|
|
|
@ -43,8 +43,6 @@ public:
|
||||||
|
|
||||||
void DialogLinkDestroy();
|
void DialogLinkDestroy();
|
||||||
|
|
||||||
static bool m_suppressContextMenu;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromGuiOk(int result);
|
virtual void FullUpdateFromGuiOk(int result);
|
||||||
virtual void FullUpdateFromGuiApply();
|
virtual void FullUpdateFromGuiApply();
|
||||||
|
|
|
@ -1159,28 +1159,17 @@ void VToolSeamAllowance::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
QAction *selectedAction = menu.exec(event->screenPos());
|
QAction *selectedAction = menu.exec(event->screenPos());
|
||||||
if (selectedAction == actionOption)
|
if (selectedAction == actionOption)
|
||||||
{
|
{
|
||||||
QSharedPointer<DialogSeamAllowance> dialog =
|
ShowOptions();
|
||||||
QSharedPointer<DialogSeamAllowance>(new DialogSeamAllowance(getData(), m_id, qApp->getMainWindow()));
|
|
||||||
dialog->EnableApply(true);
|
|
||||||
m_dialog = dialog;
|
|
||||||
m_dialog->setModal(true);
|
|
||||||
connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VToolSeamAllowance::FullUpdateFromGuiOk);
|
|
||||||
connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VToolSeamAllowance::FullUpdateFromGuiApply);
|
|
||||||
SetDialog();
|
|
||||||
m_dialog->show();
|
|
||||||
}
|
}
|
||||||
else if (selectedAction == inLayoutOption)
|
else if (selectedAction == inLayoutOption)
|
||||||
{
|
{
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(m_id, selectedAction->isChecked(),
|
ToggleInLayout(selectedAction->isChecked());
|
||||||
&(VAbstractTool::data), doc);
|
|
||||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
|
||||||
}
|
}
|
||||||
else if (selectedAction == actionRemove)
|
else if (selectedAction == actionRemove)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DeleteToolWithConfirm();
|
DeleteFromMenu();
|
||||||
}
|
}
|
||||||
catch(const VExceptionToolWasDeleted &e)
|
catch(const VExceptionToolWasDeleted &e)
|
||||||
{
|
{
|
||||||
|
@ -1381,6 +1370,34 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSeamAllowance::ShowOptions()
|
||||||
|
{
|
||||||
|
QSharedPointer<DialogSeamAllowance> dialog =
|
||||||
|
QSharedPointer<DialogSeamAllowance>(new DialogSeamAllowance(getData(), m_id, qApp->getMainWindow()));
|
||||||
|
dialog->EnableApply(true);
|
||||||
|
m_dialog = dialog;
|
||||||
|
m_dialog->setModal(true);
|
||||||
|
connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VToolSeamAllowance::FullUpdateFromGuiOk);
|
||||||
|
connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VToolSeamAllowance::FullUpdateFromGuiApply);
|
||||||
|
SetDialog();
|
||||||
|
m_dialog->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSeamAllowance::ToggleInLayout(bool checked)
|
||||||
|
{
|
||||||
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc);
|
||||||
|
connect(togglePrint, &TogglePieceInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
||||||
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSeamAllowance::DeleteFromMenu()
|
||||||
|
{
|
||||||
|
DeleteToolWithConfirm();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &rotationAngle,
|
VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &rotationAngle,
|
||||||
qreal &labelWidth, qreal &labelHeight, QPointF &pos)
|
qreal &labelWidth, qreal &labelHeight, QPointF &pos)
|
||||||
|
@ -1596,8 +1613,11 @@ void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *sc
|
||||||
|
|
||||||
if (tool->parent() != parent)
|
if (tool->parent() != parent)
|
||||||
{
|
{
|
||||||
connect(tool, &VNodePoint::ShowContextMenu, parent, &VToolSeamAllowance::contextMenuEvent);
|
connect(tool, &VNodePoint::ShowOptions, parent, &VToolSeamAllowance::ShowOptions, Qt::UniqueConnection);
|
||||||
connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(tool, &VNodePoint::ToggleInLayout, parent, &VToolSeamAllowance::ToggleInLayout,
|
||||||
|
Qt::UniqueConnection);
|
||||||
|
connect(tool, &VNodePoint::Delete, parent, &VToolSeamAllowance::DeleteFromMenu, Qt::UniqueConnection);
|
||||||
|
connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem, Qt::UniqueConnection);
|
||||||
tool->setParentItem(parent);
|
tool->setParentItem(parent);
|
||||||
tool->SetParentType(ParentType::Item);
|
tool->SetParentType(ParentType::Item);
|
||||||
tool->SetExluded(node.IsExcluded());
|
tool->SetExluded(node.IsExcluded());
|
||||||
|
|
|
@ -159,6 +159,11 @@ protected:
|
||||||
virtual void SetDialog() Q_DECL_FINAL;
|
virtual void SetDialog() Q_DECL_FINAL;
|
||||||
virtual void SaveDialogChange(const QString &undoText = QString()) Q_DECL_FINAL;
|
virtual void SaveDialogChange(const QString &undoText = QString()) Q_DECL_FINAL;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ShowOptions();
|
||||||
|
void ToggleInLayout(bool checked);
|
||||||
|
void DeleteFromMenu();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolSeamAllowance)
|
Q_DISABLE_COPY(VToolSeamAllowance)
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,10 @@ void ShowLabel::Do(bool visible)
|
||||||
{
|
{
|
||||||
doc->SetAttribute<bool>(domElement, AttrShowLabel, visible);
|
doc->SetAttribute<bool>(domElement, AttrShowLabel, visible);
|
||||||
|
|
||||||
if (VDrawTool *tool = qobject_cast<VDrawTool *>(VAbstractPattern::getTool(nodeId)))
|
if (VAbstractTool *tool = qobject_cast<VAbstractTool *>(VAbstractPattern::getTool(nodeId)))
|
||||||
{
|
{
|
||||||
tool->SetLabelVisible(nodeId, visible);
|
tool->SetLabelVisible(nodeId, visible);
|
||||||
}
|
}
|
||||||
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user