Piece path now works with passmarks.
--HG-- branch : feature
This commit is contained in:
parent
330e831815
commit
11a7bf89b4
|
@ -67,52 +67,6 @@ QVector<quint32> PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVecto
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QVector<CustomSARecord> FilterRecords(QVector<CustomSARecord> records)
|
|
||||||
{
|
|
||||||
if (records.size() < 2)
|
|
||||||
{
|
|
||||||
return records;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool foundFilter = false;// Need in case "filter" will stay empty.
|
|
||||||
CustomSARecord filter;
|
|
||||||
int startIndex = records.size()-1;
|
|
||||||
|
|
||||||
for (int i = 0; i < records.size(); ++i)
|
|
||||||
{
|
|
||||||
if (records.at(i).startPoint < static_cast<quint32>(startIndex))
|
|
||||||
{
|
|
||||||
startIndex = i;
|
|
||||||
filter = records.at(i);
|
|
||||||
foundFilter = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (not foundFilter)
|
|
||||||
{
|
|
||||||
return records; // return as is
|
|
||||||
}
|
|
||||||
|
|
||||||
records.remove(startIndex);
|
|
||||||
|
|
||||||
QVector<CustomSARecord> secondRound;
|
|
||||||
for (int i = 0; i < records.size(); ++i)
|
|
||||||
{
|
|
||||||
if (records.at(i).startPoint > filter.endPoint)
|
|
||||||
{
|
|
||||||
secondRound.append(records.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<CustomSARecord> filtered;
|
|
||||||
filtered.append(filter);
|
|
||||||
|
|
||||||
filtered += FilterRecords(secondRound);
|
|
||||||
|
|
||||||
return filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal PassmarkLength(const VSAPoint &passmarkSAPoint, qreal width)
|
qreal PassmarkLength(const VSAPoint &passmarkSAPoint, qreal width)
|
||||||
{
|
{
|
||||||
|
@ -733,6 +687,55 @@ QVector<CustomSARecord> VPiece::GetValidRecords() const
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<CustomSARecord> VPiece::FilterRecords(QVector<CustomSARecord> records) const
|
||||||
|
{
|
||||||
|
if (records.size() < 2)
|
||||||
|
{
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool foundFilter = false;// Need in case "filter" will stay empty.
|
||||||
|
CustomSARecord filter;
|
||||||
|
int startIndex = d->m_path.CountNodes()-1;
|
||||||
|
|
||||||
|
for (int i = 0; i < records.size(); ++i)
|
||||||
|
{
|
||||||
|
const int indexStartPoint = d->m_path.indexOfNode(records.at(i).startPoint);
|
||||||
|
if (indexStartPoint < startIndex)
|
||||||
|
{
|
||||||
|
startIndex = i;
|
||||||
|
filter = records.at(i);
|
||||||
|
foundFilter = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not foundFilter)
|
||||||
|
{
|
||||||
|
return records; // return as is
|
||||||
|
}
|
||||||
|
|
||||||
|
records.remove(startIndex);
|
||||||
|
|
||||||
|
QVector<CustomSARecord> secondRound;
|
||||||
|
for (int i = 0; i < records.size(); ++i)
|
||||||
|
{
|
||||||
|
const int indexStartPoint = d->m_path.indexOfNode(records.at(i).startPoint);
|
||||||
|
const int indexEndPoint = d->m_path.indexOfNode(filter.endPoint);
|
||||||
|
if (indexStartPoint > indexEndPoint)
|
||||||
|
{
|
||||||
|
secondRound.append(records.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<CustomSARecord> filtered;
|
||||||
|
filtered.append(filter);
|
||||||
|
|
||||||
|
filtered += FilterRecords(secondRound);
|
||||||
|
|
||||||
|
return filtered;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VSAPoint> VPiece::GetNodeSAPoints(int index, const VContainer *data) const
|
QVector<VSAPoint> VPiece::GetNodeSAPoints(int index, const VContainer *data) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,6 +114,7 @@ private:
|
||||||
QSharedDataPointer<VPieceData> d;
|
QSharedDataPointer<VPieceData> d;
|
||||||
|
|
||||||
QVector<CustomSARecord> GetValidRecords() const;
|
QVector<CustomSARecord> GetValidRecords() const;
|
||||||
|
QVector<CustomSARecord> FilterRecords(QVector<CustomSARecord> records) const;
|
||||||
|
|
||||||
QVector<VSAPoint> GetNodeSAPoints(int index, const VContainer *data) const;
|
QVector<VSAPoint> GetNodeSAPoints(int index, const VContainer *data) const;
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
|
||||||
|
|
||||||
InitPathTab();
|
InitPathTab();
|
||||||
InitSeamAllowanceTab();
|
InitSeamAllowanceTab();
|
||||||
|
InitPassmarksTab();
|
||||||
|
|
||||||
flagName = true;//We have default name of piece.
|
flagName = true;//We have default name of piece.
|
||||||
flagError = PathIsValid();
|
flagError = PathIsValid();
|
||||||
|
@ -62,7 +63,8 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
|
||||||
|
|
||||||
vis = new VisToolPiecePath(data);
|
vis = new VisToolPiecePath(data);
|
||||||
|
|
||||||
ui->tabWidget->removeTab(1);
|
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabSeamAllowance));
|
||||||
|
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPassmarks));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -224,6 +226,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
|
QAction *actionPassmark = nullptr;
|
||||||
QAction *actionReverse = nullptr;
|
QAction *actionReverse = nullptr;
|
||||||
if (rowNode.GetTypeTool() != Tool::NodePoint)
|
if (rowNode.GetTypeTool() != Tool::NodePoint)
|
||||||
{
|
{
|
||||||
|
@ -231,6 +234,12 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
|
||||||
actionReverse->setCheckable(true);
|
actionReverse->setCheckable(true);
|
||||||
actionReverse->setChecked(rowNode.GetReverse());
|
actionReverse->setChecked(rowNode.GetReverse());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actionPassmark = menu->addAction(tr("Passmark"));
|
||||||
|
actionPassmark->setCheckable(true);
|
||||||
|
actionPassmark->setChecked(rowNode.IsPassmark());
|
||||||
|
}
|
||||||
|
|
||||||
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
|
|
||||||
|
@ -238,16 +247,21 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
|
||||||
if (selectedAction == actionDelete)
|
if (selectedAction == actionDelete)
|
||||||
{
|
{
|
||||||
delete ui->listWidget->item(row);
|
delete ui->listWidget->item(row);
|
||||||
ValidObjects(PathIsValid());
|
|
||||||
}
|
}
|
||||||
else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
|
else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
|
||||||
{
|
{
|
||||||
rowNode.SetReverse(not rowNode.GetReverse());
|
rowNode.SetReverse(not rowNode.GetReverse());
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
rowItem->setText(GetNodeName(rowNode, true));
|
rowItem->setText(GetNodeName(rowNode, true));
|
||||||
ValidObjects(PathIsValid());
|
}
|
||||||
|
else if (selectedAction == actionPassmark)
|
||||||
|
{
|
||||||
|
rowNode.SetPassmark(not rowNode.IsPassmark());
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
rowItem->setText(GetNodeName(rowNode, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValidObjects(PathIsValid());
|
||||||
ListChanged();
|
ListChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,6 +371,68 @@ void DialogPiecePath::NodeChanged(int index)
|
||||||
ui->comboBoxAngle->blockSignals(false);
|
ui->comboBoxAngle->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::PassmarkChanged(int index)
|
||||||
|
{
|
||||||
|
ui->radioButtonOneLine->setDisabled(true);
|
||||||
|
ui->radioButtonTwoLines->setDisabled(true);
|
||||||
|
ui->radioButtonThreeLines->setDisabled(true);
|
||||||
|
|
||||||
|
ui->radioButtonStraightforward->setDisabled(true);
|
||||||
|
ui->radioButtonBisector->setDisabled(true);
|
||||||
|
|
||||||
|
ui->groupBoxLineType->blockSignals(true);
|
||||||
|
ui->groupBoxAngleType->blockSignals(true);
|
||||||
|
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
const VPiecePath path = CreatePath();
|
||||||
|
const int nodeIndex = path.indexOfNode(CURRENT_DATA(ui->comboBoxPassmarks).toUInt());
|
||||||
|
if (nodeIndex != -1)
|
||||||
|
{
|
||||||
|
const VPieceNode &node = path.at(nodeIndex);
|
||||||
|
|
||||||
|
// Line type
|
||||||
|
ui->radioButtonOneLine->setEnabled(true);
|
||||||
|
ui->radioButtonTwoLines->setEnabled(true);
|
||||||
|
ui->radioButtonThreeLines->setEnabled(true);
|
||||||
|
|
||||||
|
switch(node.GetPassmarkLineType())
|
||||||
|
{
|
||||||
|
case PassmarkLineType::OneLine:
|
||||||
|
ui->radioButtonOneLine->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::TwoLines:
|
||||||
|
ui->radioButtonTwoLines->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::ThreeLines:
|
||||||
|
ui->radioButtonThreeLines->setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Angle type
|
||||||
|
ui->radioButtonStraightforward->setEnabled(true);
|
||||||
|
ui->radioButtonBisector->setEnabled(true);
|
||||||
|
|
||||||
|
switch(node.GetPassmarkAngleType())
|
||||||
|
{
|
||||||
|
case PassmarkAngleType::Straightforward:
|
||||||
|
ui->radioButtonStraightforward->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Bisector:
|
||||||
|
ui->radioButtonBisector->setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->groupBoxLineType->blockSignals(false);
|
||||||
|
ui->groupBoxAngleType->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::ReturnDefBefore()
|
void DialogPiecePath::ReturnDefBefore()
|
||||||
{
|
{
|
||||||
|
@ -369,6 +445,70 @@ void DialogPiecePath::ReturnDefAfter()
|
||||||
ui->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance);
|
ui->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::PassmarkLineTypeChanged(int id)
|
||||||
|
{
|
||||||
|
const int i = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (i != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxPassmarks).toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
|
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
||||||
|
if (id == ui->buttonGroupLineType->id(ui->radioButtonOneLine))
|
||||||
|
{
|
||||||
|
lineType = PassmarkLineType::OneLine;
|
||||||
|
}
|
||||||
|
else if (id == ui->buttonGroupLineType->id(ui->radioButtonTwoLines))
|
||||||
|
{
|
||||||
|
lineType = PassmarkLineType::TwoLines;
|
||||||
|
}
|
||||||
|
else if (id == ui->buttonGroupLineType->id(ui->radioButtonThreeLines))
|
||||||
|
{
|
||||||
|
lineType = PassmarkLineType::ThreeLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
rowNode.SetPassmarkLineType(lineType);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
rowItem->setText(GetNodeName(rowNode, true));
|
||||||
|
|
||||||
|
ListChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::PassmarkAngleTypeChanged(int id)
|
||||||
|
{
|
||||||
|
const int i = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (i != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxPassmarks).toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
|
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
||||||
|
if (id == ui->buttonGroupAngleType->id(ui->radioButtonStraightforward))
|
||||||
|
{
|
||||||
|
angleType = PassmarkAngleType::Straightforward;
|
||||||
|
}
|
||||||
|
else if (id == ui->buttonGroupAngleType->id(ui->radioButtonBisector))
|
||||||
|
{
|
||||||
|
angleType = PassmarkAngleType::Bisector;
|
||||||
|
}
|
||||||
|
|
||||||
|
rowNode.SetPassmarkAngleType(angleType);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
rowItem->setText(GetNodeName(rowNode, true));
|
||||||
|
|
||||||
|
ListChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::EvalWidth()
|
void DialogPiecePath::EvalWidth()
|
||||||
{
|
{
|
||||||
|
@ -581,6 +721,19 @@ void DialogPiecePath::InitSeamAllowanceTab()
|
||||||
&DialogPiecePath::DeployWidthAfterFormulaTextEdit);
|
&DialogPiecePath::DeployWidthAfterFormulaTextEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarksTab()
|
||||||
|
{
|
||||||
|
InitPassmarksList();
|
||||||
|
connect(ui->comboBoxPassmarks, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
|
this, &DialogPiecePath::PassmarkChanged);
|
||||||
|
|
||||||
|
connect(ui->buttonGroupLineType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
|
||||||
|
this, &DialogPiecePath::PassmarkLineTypeChanged);
|
||||||
|
connect(ui->buttonGroupAngleType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
|
||||||
|
this, &DialogPiecePath::PassmarkAngleTypeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::InitPathTypes()
|
void DialogPiecePath::InitPathTypes()
|
||||||
{
|
{
|
||||||
|
@ -624,6 +777,40 @@ void DialogPiecePath::InitNodesList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarksList()
|
||||||
|
{
|
||||||
|
const quint32 id = CURRENT_DATA(ui->comboBoxPassmarks).toUInt();
|
||||||
|
|
||||||
|
ui->comboBoxPassmarks->blockSignals(true);
|
||||||
|
ui->comboBoxPassmarks->clear();
|
||||||
|
|
||||||
|
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(ui->listWidget);
|
||||||
|
|
||||||
|
for (int i = 0; i < nodes.size(); ++i)
|
||||||
|
{
|
||||||
|
const VPieceNode node = nodes.at(i);
|
||||||
|
if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark())
|
||||||
|
{
|
||||||
|
const QString name = GetNodeName(node);
|
||||||
|
|
||||||
|
ui->comboBoxPassmarks->addItem(name, node.GetId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->comboBoxPassmarks->blockSignals(false);
|
||||||
|
|
||||||
|
const int index = ui->comboBoxPassmarks->findData(id);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxPassmarks->setCurrentIndex(index);
|
||||||
|
PassmarkChanged(index);// Need in case combox index was not changed
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->comboBoxPassmarks->count() > 0 ? PassmarkChanged(0) : PassmarkChanged(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::NodeAngleChanged(int index)
|
void DialogPiecePath::NodeAngleChanged(int index)
|
||||||
{
|
{
|
||||||
|
@ -783,6 +970,11 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
||||||
{
|
{
|
||||||
|
if (formula.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QString width = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
const QString width = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
// increase height if needed.
|
// increase height if needed.
|
||||||
if (width.length() > 80)
|
if (width.length() > 80)
|
||||||
|
@ -795,6 +987,16 @@ void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
||||||
SCASSERT(path != nullptr)
|
SCASSERT(path != nullptr)
|
||||||
path->SetPath(CreatePath());
|
path->SetPath(CreatePath());
|
||||||
|
|
||||||
|
if (ui->tabWidget->indexOf(ui->tabSeamAllowance) == -1)
|
||||||
|
{
|
||||||
|
ui->tabWidget->addTab(ui->tabSeamAllowance, tr("Seam allowance"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->tabWidget->indexOf(ui->tabPassmarks) == -1)
|
||||||
|
{
|
||||||
|
ui->tabWidget->addTab(ui->tabPassmarks, tr("Passmarks"));
|
||||||
|
}
|
||||||
|
|
||||||
MoveCursorToEnd(ui->plainTextEditFormulaWidth);
|
MoveCursorToEnd(ui->plainTextEditFormulaWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,11 @@ private slots:
|
||||||
void ListChanged();
|
void ListChanged();
|
||||||
void NameChanged();
|
void NameChanged();
|
||||||
void NodeChanged(int index);
|
void NodeChanged(int index);
|
||||||
|
void PassmarkChanged(int index);
|
||||||
void ReturnDefBefore();
|
void ReturnDefBefore();
|
||||||
void ReturnDefAfter();
|
void ReturnDefAfter();
|
||||||
|
void PassmarkLineTypeChanged(int id);
|
||||||
|
void PassmarkAngleTypeChanged(int id);
|
||||||
|
|
||||||
void EvalWidth();
|
void EvalWidth();
|
||||||
void EvalWidthBefore();
|
void EvalWidthBefore();
|
||||||
|
@ -105,9 +108,11 @@ private:
|
||||||
|
|
||||||
void InitPathTab();
|
void InitPathTab();
|
||||||
void InitSeamAllowanceTab();
|
void InitSeamAllowanceTab();
|
||||||
|
void InitPassmarksTab();
|
||||||
void InitPathTypes();
|
void InitPathTypes();
|
||||||
void InitListPieces();
|
void InitListPieces();
|
||||||
void InitNodesList();
|
void InitNodesList();
|
||||||
|
void InitPassmarksList();
|
||||||
void NodeAngleChanged(int index);
|
void NodeAngleChanged(int index);
|
||||||
|
|
||||||
VPiecePath CreatePath() const;
|
VPiecePath CreatePath() const;
|
||||||
|
|
|
@ -792,6 +792,129 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabPassmarks">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Passmarks</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Passmark:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxPassmarks"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxLineType">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Lines</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonOneLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>One line</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupLineType</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonTwoLines">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Two lines</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupLineType</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonThreeLines">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Three lines</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupLineType</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxAngleType">
|
||||||
|
<property name="title">
|
||||||
|
<string>Angle</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonStraightforward">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Straightforward</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupAngleType</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonBisector">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Bisector</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupAngleType</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>85</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -843,4 +966,8 @@
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="buttonGroupLineType"/>
|
||||||
|
<buttongroup name="buttonGroupAngleType"/>
|
||||||
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -256,6 +256,9 @@ protected:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddVisualization();
|
void AddVisualization();
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
QVector<T> GetListInternals(const QListWidget *list) const;
|
||||||
|
|
||||||
void ChangeColor(QWidget *widget, const QColor &color);
|
void ChangeColor(QWidget *widget, const QColor &color);
|
||||||
virtual void ShowVisualization() {}
|
virtual void ShowVisualization() {}
|
||||||
/**
|
/**
|
||||||
|
@ -294,6 +297,20 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
QVector<T> DialogTool::GetListInternals(const QListWidget *list) const
|
||||||
|
{
|
||||||
|
SCASSERT(list != nullptr)
|
||||||
|
QVector<T> internals;
|
||||||
|
for (qint32 i = 0; i < list->count(); ++i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = list->item(i);
|
||||||
|
internals.append(qvariant_cast<T>(item->data(Qt::UserRole)));
|
||||||
|
}
|
||||||
|
return internals;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline VAbstractTool *DialogTool::GetAssociatedTool()
|
inline VAbstractTool *DialogTool::GetAssociatedTool()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2029,10 +2029,10 @@ void DialogSeamAllowance::PatternPinPointChanged()
|
||||||
VPiece DialogSeamAllowance::CreatePiece() const
|
VPiece DialogSeamAllowance::CreatePiece() const
|
||||||
{
|
{
|
||||||
VPiece piece;
|
VPiece piece;
|
||||||
piece.GetPath().SetNodes(GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath));
|
piece.GetPath().SetNodes(GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath));
|
||||||
piece.SetCustomSARecords(GetPieceInternals<CustomSARecord>(uiTabPaths->listWidgetCustomSA));
|
piece.SetCustomSARecords(GetListInternals<CustomSARecord>(uiTabPaths->listWidgetCustomSA));
|
||||||
piece.SetInternalPaths(GetPieceInternals<quint32>(uiTabPaths->listWidgetInternalPaths));
|
piece.SetInternalPaths(GetListInternals<quint32>(uiTabPaths->listWidgetInternalPaths));
|
||||||
piece.SetPins(GetPieceInternals<quint32>(uiTabPins->listWidgetPins));
|
piece.SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
|
||||||
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
|
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
|
||||||
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
|
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
|
||||||
piece.SetName(uiTabLabels->lineEditName->text());
|
piece.SetName(uiTabLabels->lineEditName->text());
|
||||||
|
@ -2232,7 +2232,7 @@ void DialogSeamAllowance::InitNodesList()
|
||||||
uiTabPaths->comboBoxNodes->blockSignals(true);
|
uiTabPaths->comboBoxNodes->blockSignals(true);
|
||||||
uiTabPaths->comboBoxNodes->clear();
|
uiTabPaths->comboBoxNodes->clear();
|
||||||
|
|
||||||
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
||||||
|
|
||||||
for (int i = 0; i < nodes.size(); ++i)
|
for (int i = 0; i < nodes.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -2266,7 +2266,7 @@ void DialogSeamAllowance::InitPassmarksList()
|
||||||
uiTabPassmarks->comboBoxPassmarks->blockSignals(true);
|
uiTabPassmarks->comboBoxPassmarks->blockSignals(true);
|
||||||
uiTabPassmarks->comboBoxPassmarks->clear();
|
uiTabPassmarks->comboBoxPassmarks->clear();
|
||||||
|
|
||||||
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
||||||
|
|
||||||
for (int i = 0; i < nodes.size(); ++i)
|
for (int i = 0; i < nodes.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -2495,7 +2495,7 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
|
||||||
box->clear();
|
box->clear();
|
||||||
box->addItem(tr("Empty"), NULL_ID);
|
box->addItem(tr("Empty"), NULL_ID);
|
||||||
|
|
||||||
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
||||||
|
|
||||||
for (int i = 0; i < nodes.size(); ++i)
|
for (int i = 0; i < nodes.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -2522,7 +2522,7 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box)
|
||||||
box->clear();
|
box->clear();
|
||||||
box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID);
|
box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID);
|
||||||
|
|
||||||
const QVector<quint32> pins = GetPieceInternals<quint32>(uiTabPins->listWidgetPins);
|
const QVector<quint32> pins = GetListInternals<quint32>(uiTabPins->listWidgetPins);
|
||||||
|
|
||||||
for (int i = 0; i < pins.size(); ++i)
|
for (int i = 0; i < pins.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -2803,20 +2803,6 @@ void DialogSeamAllowance::ClearFields()
|
||||||
uiTabLabels->comboBoxPlacement->setCurrentIndex(0);
|
uiTabLabels->comboBoxPlacement->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <typename T>
|
|
||||||
QVector<T> DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const
|
|
||||||
{
|
|
||||||
SCASSERT(list != nullptr)
|
|
||||||
QVector<T> internals;
|
|
||||||
for (qint32 i = 0; i < list->count(); ++i)
|
|
||||||
{
|
|
||||||
QListWidgetItem *item = list->item(i);
|
|
||||||
internals.append(qvariant_cast<T>(item->data(Qt::UserRole)));
|
|
||||||
}
|
|
||||||
return internals;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
|
void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
|
||||||
{
|
{
|
||||||
|
@ -2984,7 +2970,7 @@ void DialogSeamAllowance::ShowPins()
|
||||||
m_visPins = new VisPiecePins(data);
|
m_visPins = new VisPiecePins(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_visPins->SetPins(GetPieceInternals<quint32>(uiTabPins->listWidgetPins));
|
m_visPins->SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
|
||||||
|
|
||||||
if (not qApp->getCurrentScene()->items().contains(m_visPins))
|
if (not qApp->getCurrentScene()->items().contains(m_visPins))
|
||||||
{
|
{
|
||||||
|
|
|
@ -256,9 +256,6 @@ private:
|
||||||
|
|
||||||
void SetFormulaSAWidth(const QString &formula);
|
void SetFormulaSAWidth(const QString &formula);
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
QVector<T> GetPieceInternals(const QListWidget *list) const;
|
|
||||||
|
|
||||||
void SetGrainlineAngle(QString angleFormula);
|
void SetGrainlineAngle(QString angleFormula);
|
||||||
void SetGrainlineLength(QString lengthFormula);
|
void SetGrainlineLength(QString lengthFormula);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user