Minor refactoring.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-02-11 14:16:49 +02:00
parent 7d1c4bc3ba
commit 61173f75c4
5 changed files with 31 additions and 42 deletions

View File

@ -768,11 +768,14 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
Tool tool;
const QStringList types = QStringList() << VAbstractPattern::NodePoint
<< VAbstractPattern::NodeArc
<< VAbstractPattern::NodeSpline
<< VAbstractPattern::NodeSplinePath
<< VAbstractPattern::NodeElArc;
const QStringList types
{
VAbstractPattern::NodePoint,
VAbstractPattern::NodeArc,
VAbstractPattern::NodeSpline,
VAbstractPattern::NodeSplinePath,
VAbstractPattern::NodeElArc
};
switch (types.indexOf(t))
{

View File

@ -462,14 +462,7 @@ bool VMeasurements::IsReadOnly() const
//---------------------------------------------------------------------------------------------------------------------
void VMeasurements::SetReadOnly(bool ro)
{
if (ro)
{
setTagText(TagReadOnly, trueStr);
}
else
{
setTagText(TagReadOnly, falseStr);
}
setTagText(TagReadOnly, ro ? trueStr : falseStr);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -1428,7 +1428,7 @@ void VToolSeamAllowance::ShowOptions()
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::ToggleInLayout(bool checked)
{
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc);
auto togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc);
connect(togglePrint, &TogglePieceInLayout::Toggled, doc, &VAbstractPattern::CheckInLayoutList);
qApp->getUndoStack()->push(togglePrint);
}

View File

@ -115,19 +115,10 @@ bool SavePlaceLabelOptions::mergeWith(const QUndoCommand *command)
const SavePlaceLabelOptions *saveCommand = static_cast<const SavePlaceLabelOptions *>(command);
SCASSERT(saveCommand != nullptr);
if (saveCommand->LabelId() != nodeId)
if (saveCommand->LabelId() != nodeId || m_newLabel.GetCenterPoint() != saveCommand->NewLabel().GetCenterPoint())
{
return false;
}
else
{
const VPlaceLabelItem candidate = saveCommand->NewLabel();
if (m_newLabel.GetCenterPoint() != candidate.GetCenterPoint())
{
return false;
}
}
m_newLabel = saveCommand->NewLabel();
return true;

View File

@ -43,7 +43,9 @@
Q_DECLARE_LOGGING_CATEGORY(vUndo)
enum class UndoCommand: char { AddPatternPiece,
enum class UndoCommand: char
{
AddPatternPiece,
AddToCalc,
MoveSpline,
MoveSplinePath,