Handle path seam allowance settings in separate tab.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-28 13:58:17 +02:00
parent 24e5aa1039
commit 51df681fbc
8 changed files with 564 additions and 86 deletions

View File

@ -37,7 +37,8 @@
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent) DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent), : DialogTool(data, toolId, parent),
ui(new Ui::DialogPiecePath), ui(new Ui::DialogPiecePath),
m_showMode(false) m_showMode(false),
m_saWidth(0)
{ {
ui->setupUi(this); ui->setupUi(this);
InitOkCancel(ui); InitOkCancel(ui);
@ -56,6 +57,37 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
flagError = PathIsValid(); flagError = PathIsValid();
CheckState(); CheckState();
const QString suffix = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit(), true);
ui->doubleSpinBoxSeams->setSuffix(suffix);
ui->doubleSpinBoxSABefore->setSuffix(suffix);
ui->doubleSpinBoxSAAfter->setSuffix(suffix);
if(qApp->patternUnit() == Unit::Inch)
{
ui->doubleSpinBoxSeams->setDecimals(5);
ui->doubleSpinBoxSABefore->setDecimals(5);
ui->doubleSpinBoxSAAfter->setDecimals(5);
}
InitNodesList();
connect(ui->comboBoxNodes, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogPiecePath::NodeChanged);
connect(ui->pushButtonDefBefore, &QPushButton::clicked, this, &DialogPiecePath::ReturnDefBefore);
connect(ui->pushButtonDefAfter, &QPushButton::clicked, this, &DialogPiecePath::ReturnDefAfter);
connect(ui->doubleSpinBoxSeams, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
[this](){NodeChanged(ui->comboBoxNodes->currentIndex());});
connect(ui->doubleSpinBoxSABefore, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogPiecePath::ChangedSABefore);
connect(ui->doubleSpinBoxSAAfter, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogPiecePath::ChangedSAAfter);
InitNodeAngles(ui->comboBoxAngle);
connect(ui->comboBoxAngle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogPiecePath::NodeAngleChanged);
if (not m_showMode) if (not m_showMode)
{ {
vis = new VisToolPiecePath(data); vis = new VisToolPiecePath(data);
@ -65,6 +97,8 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
ui->comboBoxType->setDisabled(true); ui->comboBoxType->setDisabled(true);
ui->comboBoxPiece->setDisabled(true); ui->comboBoxPiece->setDisabled(true);
} }
ui->tabWidget->removeTab(1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -221,6 +255,8 @@ void DialogPiecePath::ListChanged()
visPath->SetPath(CreatePath()); visPath->SetPath(CreatePath());
visPath->RefreshGeometry(); visPath->RefreshGeometry();
} }
InitNodesList();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -239,6 +275,101 @@ void DialogPiecePath::NameChanged()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::NodeChanged(int index)
{
ui->doubleSpinBoxSABefore->setDisabled(true);
ui->doubleSpinBoxSAAfter->setDisabled(true);
ui->pushButtonDefBefore->setDisabled(true);
ui->pushButtonDefAfter->setDisabled(true);
ui->comboBoxAngle->setDisabled(true);
ui->doubleSpinBoxSABefore->blockSignals(true);
ui->doubleSpinBoxSAAfter->blockSignals(true);
ui->comboBoxAngle->blockSignals(true);
if (index != -1)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
#else
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
#endif
const VPiecePath path = CreatePath();
const int nodeIndex = path.indexOfNode(id);
if (nodeIndex != -1)
{
const VPieceNode &node = path.at(nodeIndex);
ui->doubleSpinBoxSABefore->setEnabled(true);
ui->doubleSpinBoxSAAfter->setEnabled(true);
ui->comboBoxAngle->setEnabled(true);
qreal w1 = node.GetSABefore();
if (w1 < 0)
{
w1 = m_saWidth;
}
else
{
ui->pushButtonDefBefore->setEnabled(true);
}
ui->doubleSpinBoxSABefore->setValue(w1);
qreal w2 = node.GetSAAfter();
if (w2 < 0)
{
w2 = m_saWidth;
}
else
{
ui->pushButtonDefAfter->setEnabled(true);
}
ui->doubleSpinBoxSAAfter->setValue(w2);
const int index = ui->comboBoxAngle->findData(static_cast<unsigned char>(node.GetAngleType()));
if (index != -1)
{
ui->comboBoxAngle->setCurrentIndex(index);
}
}
}
else
{
ui->doubleSpinBoxSABefore->setValue(0);
ui->doubleSpinBoxSAAfter->setValue(0);
ui->comboBoxAngle->setCurrentIndex(-1);
}
ui->doubleSpinBoxSABefore->blockSignals(false);
ui->doubleSpinBoxSAAfter->blockSignals(false);
ui->comboBoxAngle->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ReturnDefBefore()
{
SetCurrentSABefore(-1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ReturnDefAfter()
{
SetCurrentSAAfter(-1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ChangedSABefore(double d)
{
SetCurrentSABefore(d);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ChangedSAAfter(double d)
{
SetCurrentSAAfter(d);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::InitPathTypes() void DialogPiecePath::InitPathTypes()
{ {
@ -246,6 +377,74 @@ void DialogPiecePath::InitPathTypes()
//ui->comboBoxType->addItem(tr("Internal path"), static_cast<int>(PiecePathType::InternalPath)); //ui->comboBoxType->addItem(tr("Internal path"), static_cast<int>(PiecePathType::InternalPath));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::InitNodesList()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
const quint32 id = ui->comboBoxNodes->itemData(ui->comboBoxNodes->currentIndex()).toUInt();
#else
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
#endif
ui->comboBoxNodes->blockSignals(true);
ui->comboBoxNodes->clear();
const VPiecePath path = CreatePath();
for (int i = 0; i < path.CountNodes(); ++i)
{
const VPieceNode node = path.at(i);
if (node.GetTypeTool() == Tool::NodePoint)
{
const QString name = GetNodeName(node);
ui->comboBoxNodes->addItem(name, node.GetId());
}
}
ui->comboBoxNodes->blockSignals(false);
const int index = ui->comboBoxNodes->findData(id);
if (index != -1)
{
ui->comboBoxNodes->setCurrentIndex(index);
NodeChanged(index);// Need in case combox index was not changed
}
else
{
ui->comboBoxNodes->count() > 0 ? NodeChanged(0) : NodeChanged(-1);
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::NodeAngleChanged(int index)
{
const int i = ui->comboBoxNodes->currentIndex();
if (i != -1 && index != -1)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
const quint32 id = ui->comboBoxNodes->itemData(i).toUInt();
#else
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
#endif
QListWidgetItem *rowItem = GetItemById(id);
if (rowItem)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->itemData(index).toUInt());
#else
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt());
#endif
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
rowNode.SetAngleType(angle);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
ListChanged();
}
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPiecePath DialogPiecePath::GetPiecePath() const VPiecePath DialogPiecePath::GetPiecePath() const
{ {
@ -292,6 +491,70 @@ void DialogPiecePath::SetType(PiecePathType type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QListWidgetItem *DialogPiecePath::GetItemById(quint32 id)
{
for (qint32 i = 0; i < ui->listWidget->count(); ++i)
{
QListWidgetItem *item = ui->listWidget->item(i);
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
if (node.GetId() == id)
{
return item;
}
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SetCurrentSABefore(qreal value)
{
const int index = ui->comboBoxNodes->currentIndex();
if (index != -1)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
#else
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
#endif
QListWidgetItem *rowItem = GetItemById(id);
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
rowNode.SetSABefore(value);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SetCurrentSAAfter(qreal value)
{
const int index = ui->comboBoxNodes->currentIndex();
if (index != -1)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
#else
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
#endif
QListWidgetItem *rowItem = GetItemById(id);
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
rowNode.SetSAAfter(value);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
ListChanged();
}
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogPiecePath::GetPieceId() const quint32 DialogPiecePath::GetPieceId() const
{ {
@ -327,6 +590,20 @@ void DialogPiecePath::SetPieceId(quint32 id)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SetSAWidth(qreal width)
{
if (width >=0)
{
m_saWidth = width;
ui->tabWidget->addTab(ui->tabSeamAllowance, QString());
}
else
{
ui->tabWidget->removeTab(1);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SetPiecesList(const QVector<quint32> &list) void DialogPiecePath::SetPiecesList(const QVector<quint32> &list)
{ {

View File

@ -51,6 +51,8 @@ public:
quint32 GetPieceId() const; quint32 GetPieceId() const;
void SetPieceId(quint32 id); void SetPieceId(quint32 id);
void SetSAWidth(qreal width);
virtual void SetPiecesList(const QVector<quint32> &list) Q_DECL_OVERRIDE; virtual void SetPiecesList(const QVector<quint32> &list) Q_DECL_OVERRIDE;
public slots: public slots:
@ -66,14 +68,22 @@ private slots:
void ShowContextMenu(const QPoint &pos); void ShowContextMenu(const QPoint &pos);
void ListChanged(); void ListChanged();
void NameChanged(); void NameChanged();
void NodeChanged(int index);
void ReturnDefBefore();
void ReturnDefAfter();
void ChangedSABefore(double d);
void ChangedSAAfter(double d);
private: private:
Q_DISABLE_COPY(DialogPiecePath) Q_DISABLE_COPY(DialogPiecePath)
Ui::DialogPiecePath *ui; Ui::DialogPiecePath *ui;
bool m_showMode; bool m_showMode;
qreal m_saWidth;
void InitPathTypes(); void InitPathTypes();
void InitListPieces(); void InitListPieces();
void InitNodesList();
void NodeAngleChanged(int index);
VPiecePath CreatePath() const; VPiecePath CreatePath() const;
@ -83,6 +93,11 @@ private:
PiecePathType GetType() const; PiecePathType GetType() const;
void SetType(PiecePathType type); void SetType(PiecePathType type);
QListWidgetItem *GetItemById(quint32 id);
void SetCurrentSABefore(qreal value);
void SetCurrentSAAfter(qreal value);
}; };
#endif // DIALOGPIECEPATH_H #endif // DIALOGPIECEPATH_H

View File

@ -6,76 +6,265 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>365</width> <width>480</width>
<height>337</height> <height>409</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QFormLayout" name="formLayout"> <widget class="QTabWidget" name="tabWidget">
<property name="fieldGrowthPolicy"> <property name="currentIndex">
<enum>QFormLayout::ExpandingFieldsGrow</enum> <number>1</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditName">
<property name="text">
<string>Unnamed path</string>
</property>
<property name="placeholderText">
<string>Create name for your path</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelType">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxType"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPiece">
<property name="text">
<string>Piece:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxPiece"/>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="helpLabel">
<property name="text">
<string>Ready!</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property> </property>
<widget class="QWidget" name="tabPath">
<attribute name="title">
<string>Path</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditName">
<property name="text">
<string>Unnamed path</string>
</property>
<property name="placeholderText">
<string>Create name for your path</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelType">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxType"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPiece">
<property name="text">
<string>Piece:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxPiece"/>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="helpLabel">
<property name="text">
<string>Ready!</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSeamAllowance">
<attribute name="title">
<string>Seam allowance</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelEditWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxSeams">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="maximum">
<double>900.990000000000009</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Nodes</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelNode">
<property name="text">
<string>Node:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxNodes"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSABefore">
<property name="toolTip">
<string>Seam allowance before node</string>
</property>
<property name="text">
<string>Before:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxSABefore">
<property name="maximum">
<double>900.990000000000009</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDefBefore">
<property name="toolTip">
<string>Return to default width</string>
</property>
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSAAfter">
<property name="toolTip">
<string>Seam allowance after node</string>
</property>
<property name="text">
<string>After:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxSAAfter">
<property name="maximum">
<double>900.990000000000009</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDefAfter">
<property name="toolTip">
<string>Return to default width</string>
</property>
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelAngle">
<property name="text">
<string>Angle:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxAngle"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item> <item>

View File

@ -91,7 +91,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
connect(ui->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this, &DialogSeamAllowance::ListChanged); connect(ui->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this, &DialogSeamAllowance::ListChanged);
connect(ui->checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance); connect(ui->checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance);
InitNodeAngles(); InitNodeAngles(ui->comboBoxAngle);
connect(ui->comboBoxAngle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(ui->comboBoxAngle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogSeamAllowance::NodeAngleChanged); &DialogSeamAllowance::NodeAngleChanged);
@ -109,7 +109,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
vis = new VisToolPiece(data); vis = new VisToolPiece(data);
} }
ui->tabWidget->setCurrentIndex(1);// Show always first tab active on start. ui->tabWidget->setCurrentIndex(0);// Show always first tab active on start.
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -770,24 +770,6 @@ void DialogSeamAllowance::InitNodesList()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitNodeAngles()
{
ui->comboBoxAngle->clear();
ui->comboBoxAngle->addItem(tr("by length"), static_cast<unsigned char>(PieceNodeAngle::ByLength));
ui->comboBoxAngle->addItem(tr("by points intersetions"),
static_cast<unsigned char>(PieceNodeAngle::ByPointsIntersection));
ui->comboBoxAngle->addItem(tr("by first edge symmetry"),
static_cast<unsigned char>(PieceNodeAngle::ByFirstEdgeSymmetry));
ui->comboBoxAngle->addItem(tr("by second edge symmetry"),
static_cast<unsigned char>(PieceNodeAngle::BySecondEdgeSymmetry));
ui->comboBoxAngle->addItem(tr("by first edge right angle"),
static_cast<unsigned char>(PieceNodeAngle::ByFirstEdgeRightAngle));
ui->comboBoxAngle->addItem(tr("by second edge right angle"),
static_cast<unsigned char>(PieceNodeAngle::BySecondEdgeRightAngle));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id) QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id)
{ {

View File

@ -94,7 +94,6 @@ private:
void ValidObjects(bool value); void ValidObjects(bool value);
bool MainPathIsClockwise() const; bool MainPathIsClockwise() const;
void InitNodesList(); void InitNodesList();
void InitNodeAngles();
void InitCSAPoint(QComboBox *box); void InitCSAPoint(QComboBox *box);
QListWidgetItem *GetItemById(quint32 id); QListWidgetItem *GetItemById(quint32 id);

View File

@ -21,7 +21,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tabMainPath"> <widget class="QWidget" name="tabMainPath">
<attribute name="title"> <attribute name="title">

View File

@ -502,6 +502,20 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::InitNodeAngles(QComboBox *box)
{
SCASSERT(box != nullptr);
box->clear();
box->addItem(tr("by length"), static_cast<unsigned char>(PieceNodeAngle::ByLength));
box->addItem(tr("by points intersetions"), static_cast<unsigned char>(PieceNodeAngle::ByPointsIntersection));
box->addItem(tr("by first edge symmetry"), static_cast<unsigned char>(PieceNodeAngle::ByFirstEdgeSymmetry));
box->addItem(tr("by second edge symmetry"), static_cast<unsigned char>(PieceNodeAngle::BySecondEdgeSymmetry));
box->addItem(tr("by first edge right angle"), static_cast<unsigned char>(PieceNodeAngle::ByFirstEdgeRightAngle));
box->addItem(tr("by second edge right angle"), static_cast<unsigned char>(PieceNodeAngle::BySecondEdgeRightAngle));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogTool::IsSplinePath(const QSharedPointer<VGObject> &obj) const bool DialogTool::IsSplinePath(const QSharedPointer<VGObject> &obj) const
{ {

View File

@ -283,6 +283,8 @@ protected:
QString GetNodeName(const VPieceNode &node) const; QString GetNodeName(const VPieceNode &node) const;
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node); void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);
void InitNodeAngles(QComboBox *box);
private: private:
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const; void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;