Resolved issue #520. Improve Union tool. An option to select about original
pieces. --HG-- branch : develop
This commit is contained in:
parent
d429407c35
commit
c89243a288
|
@ -33,6 +33,7 @@
|
|||
- [#514] Read only setting not working properly.
|
||||
- [#480] New tool: Midpoint between two points.
|
||||
- [#496] Selector for selecting which pieces to print.
|
||||
- [#520] Improve Union tool. An option to select about original pieces.
|
||||
|
||||
# Version 0.4.5
|
||||
- [#435] Valentina doesn't change the cursor.
|
||||
|
|
|
@ -51,6 +51,12 @@ DialogUnionDetails::~DialogUnionDetails()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogUnionDetails::RetainPieces() const
|
||||
{
|
||||
return ui->checkBox->isChecked();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ChoosedObject gets id and type of selected object. Save correct data and ignore wrong.
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
quint32 getD2() const;
|
||||
int getIndexD1() const;
|
||||
int getIndexD2() const;
|
||||
|
||||
bool RetainPieces() const;
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>78</height>
|
||||
<height>96</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -24,13 +24,20 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Do you really want to unite details?</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Retain original pieces</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -520,9 +520,10 @@ VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsSc
|
|||
VDetail d2 = data->GetDetail(dialogTool->getD2());
|
||||
quint32 indexD1 = static_cast<quint32>(dialogTool->getIndexD1());
|
||||
quint32 indexD2 = static_cast<quint32>(dialogTool->getIndexD2());
|
||||
const bool retainPieces = dialogTool->RetainPieces();
|
||||
qApp->getUndoStack()->beginMacro(tr("union details"));
|
||||
VToolUnionDetails* tool = Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene,
|
||||
doc, data, Document::FullParse, Source::FromGui);
|
||||
doc, data, Document::FullParse, Source::FromGui, retainPieces);
|
||||
qApp->getUndoStack()->endMacro();
|
||||
return tool;
|
||||
}
|
||||
|
@ -546,7 +547,8 @@ VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsSc
|
|||
VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2,
|
||||
const quint32 &d1id, const quint32 &d2id, const quint32 &indexD1,
|
||||
const quint32 &indexD2, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
VContainer *data, const Document &parse, const Source &typeCreation,
|
||||
bool retainPieces)
|
||||
{
|
||||
VToolUnionDetails *unionDetails = 0;
|
||||
quint32 id = _id;
|
||||
|
@ -639,17 +641,22 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||
SCASSERT(tools != nullptr);
|
||||
|
||||
if (not retainPieces)
|
||||
{
|
||||
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d1id));
|
||||
SCASSERT(toolDet != nullptr);
|
||||
bool ask = false;
|
||||
toolDet->Remove(ask);
|
||||
}
|
||||
{
|
||||
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d1id));
|
||||
SCASSERT(toolDet != nullptr);
|
||||
bool ask = false;
|
||||
toolDet->Remove(ask);
|
||||
}
|
||||
|
||||
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d2id));
|
||||
SCASSERT(toolDet != nullptr);
|
||||
bool ask = false;
|
||||
toolDet->Remove(ask);
|
||||
{
|
||||
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d2id));
|
||||
SCASSERT(toolDet != nullptr);
|
||||
const bool ask = false;
|
||||
toolDet->Remove(ask);
|
||||
}
|
||||
}
|
||||
|
||||
SCASSERT(not children.isEmpty())
|
||||
SaveChildren(doc, id, children);
|
||||
|
|
|
@ -52,7 +52,8 @@ public:
|
|||
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2,
|
||||
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||
const Document &parse,
|
||||
const Source &typeCreation);
|
||||
const Source &typeCreation,
|
||||
bool retainPieces = false);
|
||||
static void PointsOnEdge(const VDetail &d, const quint32 &index, VPointF &p1, VPointF &p2, VContainer *data);
|
||||
static void FindIndexJ(const qint32 &pointsD2, const VDetail &d2, const quint32 &indexD2, qint32 &j);
|
||||
static QVector<VDetail> GetDetailFromFile(VAbstractPattern *doc, const QDomElement &domElement);
|
||||
|
|
Loading…
Reference in New Issue
Block a user