New feature multi deletion pieces.
--HG-- branch : develop
This commit is contained in:
parent
6bbd54f6ef
commit
8eecfe78a3
|
@ -1146,15 +1146,33 @@ void VToolSeamAllowance::keyReleaseEvent(QKeyEvent *event)
|
||||||
switch (event->key())
|
switch (event->key())
|
||||||
{
|
{
|
||||||
case Qt::Key_Delete:
|
case Qt::Key_Delete:
|
||||||
|
if (ConfirmDeletion() == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
const QList<VToolSeamAllowance *> toolList = SelectedTools();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DeleteTool();
|
if (not toolList.isEmpty())
|
||||||
|
{
|
||||||
|
qApp->getUndoStack()->beginMacro(tr("multi deletion"));
|
||||||
|
|
||||||
|
for(int i=0; i < toolList.size(); ++i)
|
||||||
|
{
|
||||||
|
toolList.at(i)->Remove(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeleteTool(false);
|
||||||
}
|
}
|
||||||
catch(const VExceptionToolWasDeleted &e)
|
catch(const VExceptionToolWasDeleted &e)
|
||||||
{
|
{
|
||||||
Q_UNUSED(e);
|
Q_UNUSED(e);
|
||||||
|
if (not toolList.isEmpty())
|
||||||
|
{
|
||||||
|
qApp->getUndoStack()->endMacro();
|
||||||
|
}
|
||||||
return;//Leave this method immediately!!!
|
return;//Leave this method immediately!!!
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1648,3 +1666,27 @@ void VToolSeamAllowance::UpdateLabelItem(VTextGraphicsItem *labelItem, QPointF p
|
||||||
labelItem->Update();
|
labelItem->Update();
|
||||||
labelItem->GetTextLines() > 0 ? labelItem->show() : labelItem->hide();
|
labelItem->GetTextLines() > 0 ? labelItem->show() : labelItem->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QList<VToolSeamAllowance *> VToolSeamAllowance::SelectedTools() const
|
||||||
|
{
|
||||||
|
QList<VToolSeamAllowance *> tools;
|
||||||
|
if(m_sceneDetails)
|
||||||
|
{
|
||||||
|
const QList<QGraphicsItem *> list = m_sceneDetails->selectedItems();
|
||||||
|
|
||||||
|
if (not list.isEmpty())
|
||||||
|
{
|
||||||
|
for(int i=0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
VToolSeamAllowance *tool = qgraphicsitem_cast<VToolSeamAllowance *>(list.at(i));
|
||||||
|
if (tool->getId() != m_id)
|
||||||
|
{
|
||||||
|
tools.append(tool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tools;
|
||||||
|
}
|
||||||
|
|
|
@ -190,6 +190,8 @@ private:
|
||||||
bool PrepareLabelData(const VPatternLabelData &labelData, VTextGraphicsItem *labelItem, QPointF &pos,
|
bool PrepareLabelData(const VPatternLabelData &labelData, VTextGraphicsItem *labelItem, QPointF &pos,
|
||||||
qreal &labelAngle);
|
qreal &labelAngle);
|
||||||
void UpdateLabelItem(VTextGraphicsItem *labelItem, QPointF pos, qreal labelAngle);
|
void UpdateLabelItem(VTextGraphicsItem *labelItem, QPointF pos, qreal labelAngle);
|
||||||
|
|
||||||
|
QList<VToolSeamAllowance *> SelectedTools() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLSEAMALLOWANCE_H
|
#endif // VTOOLSEAMALLOWANCE_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user