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())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
if (ConfirmDeletion() == QMessageBox::Yes)
|
||||
{
|
||||
const QList<VToolSeamAllowance *> toolList = SelectedTools();
|
||||
|
||||
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)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
if (not toolList.isEmpty())
|
||||
{
|
||||
qApp->getUndoStack()->endMacro();
|
||||
}
|
||||
return;//Leave this method immediately!!!
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1648,3 +1666,27 @@ void VToolSeamAllowance::UpdateLabelItem(VTextGraphicsItem *labelItem, QPointF p
|
|||
labelItem->Update();
|
||||
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,
|
||||
qreal &labelAngle);
|
||||
void UpdateLabelItem(VTextGraphicsItem *labelItem, QPointF pos, qreal labelAngle);
|
||||
|
||||
QList<VToolSeamAllowance *> SelectedTools() const;
|
||||
};
|
||||
|
||||
#endif // VTOOLSEAMALLOWANCE_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user