Resolved issue #790. Generate unique name for each detail.
--HG-- branch : develop
This commit is contained in:
parent
a1c1192c61
commit
ae39a2b488
|
@ -34,6 +34,7 @@
|
|||
- [#774] New feature. Matching Parentheses.
|
||||
- [#779] Add more roll paper size templates.
|
||||
- [#783] Flipping control.
|
||||
- [#790] Generate unique name for each detail.
|
||||
|
||||
# Version 0.5.1
|
||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||
|
|
|
@ -2863,6 +2863,8 @@ void DialogSeamAllowance::InitLabelsTab()
|
|||
connect(uiTabLabels->pushButtonShowPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLHeight);
|
||||
connect(uiTabLabels->pushButtonShowPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLAngle);
|
||||
|
||||
uiTabLabels->lineEditName->setText(GetDefaultPieceName());
|
||||
|
||||
EnabledPatternLabel();
|
||||
}
|
||||
|
||||
|
@ -3247,3 +3249,25 @@ VPlaceLabelItem DialogSeamAllowance::CurrentPlaceLabel(quint32 id) const
|
|||
{
|
||||
return m_newPlaceLabels.contains(id) ? m_newPlaceLabels.value(id) : *data->GeometricObject<VPlaceLabelItem>(id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSeamAllowance::GetDefaultPieceName() const
|
||||
{
|
||||
QList<VPiece> pieces = data->DataPieces()->values();
|
||||
QSet<QString> names;
|
||||
|
||||
for (int i = 0; i < pieces.size(); ++i)
|
||||
{
|
||||
names.insert(pieces.at(i).GetName());
|
||||
}
|
||||
|
||||
const QString defName = tr("Detail");
|
||||
QString name = defName;
|
||||
int i = 0;
|
||||
|
||||
while(names.contains(name))
|
||||
{
|
||||
name = defName + QString("_%1").arg(++i);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -276,6 +276,8 @@ private:
|
|||
|
||||
VPiecePath CurrentPath(quint32 id) const;
|
||||
VPlaceLabelItem CurrentPlaceLabel(quint32 id) const;
|
||||
|
||||
QString GetDefaultPieceName() const;
|
||||
};
|
||||
|
||||
#endif // DIALOGSEAMALLOWANCE_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user