Dialog Seam allowance tool now supports passmarks.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-24 13:08:16 +02:00
parent ad23a75d7a
commit 81b88db5cc
16 changed files with 523 additions and 30 deletions

View File

@ -54,8 +54,6 @@ int main(int argc, char *argv[])
qt_qhash_seed.store(0); // Lock producing random attribute order in XML
qRegisterMetaTypeStreamOperators<VPieceNode>("VPieceNode");
#ifndef Q_OS_MAC // supports natively
InitHighDpiScaling(argc, argv);
#endif //Q_OS_MAC

View File

@ -89,6 +89,19 @@ enum class PieceNodeAngle : unsigned char
BySecondEdgeRightAngle
};
enum class PassmarkLineType : unsigned char
{
OneLine = 0,
TwoLines,
ThreeLines
};
enum class PassmarkAngleType : unsigned char
{
Straightforward = 0,
Bisector
};
enum class PiecePathIncludeType : unsigned char
{
AsMainPath = 0,

View File

@ -74,5 +74,7 @@
<file>icon/32x32/paths@2x.png</file>
<file>icon/32x32/pins.png</file>
<file>icon/32x32/pins@2x.png</file>
<file>icon/32x32/passmark.png</file>
<file>icon/32x32/passmark@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 348.1 348.1"
style="enable-background:new 0 0 348.1 348.1;"
xml:space="preserve"
sodipodi:docname="passmark.svg"
inkscape:export-filename="/home/dismine/CAD/Valentina_0.5.x/valentina/src/libs/vmisc/share/resources/icon/32x32/passmark.png"
inkscape:export-xdpi="8.8250504"
inkscape:export-ydpi="8.8250504"
inkscape:version="0.92.1 unknown"><metadata
id="metadata43"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs41" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1500"
inkscape:window-height="941"
id="namedview39"
showgrid="false"
inkscape:zoom="0.95878884"
inkscape:cx="309.49411"
inkscape:cy="242.53486"
inkscape:window-x="160"
inkscape:window-y="34"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" /><g
id="g8" /><g
id="g10" /><g
id="g12" /><g
id="g14" /><g
id="g16" /><g
id="g18" /><g
id="g20" /><g
id="g22" /><g
id="g24" /><g
id="g26" /><g
id="g28" /><g
id="g30" /><g
id="g32" /><g
id="g34" /><g
id="g36" /><path
style="fill:#40c0e7;fill-opacity:1;fill-rule:evenodd;stroke:#40c0e7;stroke-width:26.50922966;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 14.766461,125.24325 212.73792,337.58203"
id="path4499-6"
inkscape:connector-curvature="0" /><path
style="fill:#1e1b0f;fill-opacity:1;fill-rule:evenodd;stroke:#40c0e7;stroke-width:26.6836853;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 73.263343,70.634795 274.48873,282.53507"
id="path4499-6-7"
inkscape:connector-curvature="0" /><path
style="fill:#1e1b0f;fill-opacity:1;fill-rule:evenodd;stroke:#40c0e7;stroke-width:26.50922966;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 133.84547,11.64291 333.75508,222.15799"
id="path4499-6-5"
inkscape:connector-curvature="0" /></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -215,25 +215,43 @@ void VPieceNode::SetAngleType(PieceNodeAngle type)
}
}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream& operator<<(QDataStream& out, const VPieceNode& p)
bool VPieceNode::IsPassmark() const
{
out << p.d->m_id << static_cast<int>(p.d->m_typeTool) << p.d->m_reverse;
return out;
return d->m_isPassmark;
}
//---------------------------------------------------------------------------------------------------------------------
QDataStream& operator>>(QDataStream& in, VPieceNode& p)
void VPieceNode::SetPassmark(bool passmark)
{
in >> p.d->m_id;
if (GetTypeTool() == Tool::NodePoint)
{
d->m_isPassmark = passmark;
}
}
int type = 0;
in >> type;
p.d->m_typeTool = static_cast<Tool>(type);
//---------------------------------------------------------------------------------------------------------------------
PassmarkLineType VPieceNode::GetPassmarkLineType() const
{
return d->m_passmarkLineType;
}
in >> p.d->m_reverse;
return in;
//---------------------------------------------------------------------------------------------------------------------
void VPieceNode::SetPassmarkLineType(PassmarkLineType lineType)
{
d->m_passmarkLineType = lineType;
}
//---------------------------------------------------------------------------------------------------------------------
PassmarkAngleType VPieceNode::GetPassmarkAngleType() const
{
return d->m_passmarkAngleType;
}
//---------------------------------------------------------------------------------------------------------------------
void VPieceNode::SetPassmarkAngleType(PassmarkAngleType angleType)
{
d->m_passmarkAngleType = angleType;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -47,9 +47,6 @@ public:
VPieceNode &operator=(const VPieceNode &node);
~VPieceNode();
friend QDataStream& operator<<(QDataStream& out, const VPieceNode& p);
friend QDataStream& operator>>(QDataStream& in, VPieceNode& p);
quint32 GetId() const;
void SetId(quint32 id);
@ -76,6 +73,15 @@ public:
PieceNodeAngle GetAngleType() const;
void SetAngleType(PieceNodeAngle type);
bool IsPassmark() const;
void SetPassmark(bool passmark);
PassmarkLineType GetPassmarkLineType() const;
void SetPassmarkLineType(PassmarkLineType lineType);
PassmarkAngleType GetPassmarkAngleType() const;
void SetPassmarkAngleType(PassmarkAngleType angleType);
private:
QSharedDataPointer<VPieceNodeData> d;
};

View File

@ -44,11 +44,14 @@ public:
m_typeTool(Tool::NodePoint),
m_reverse(false),
m_excluded(false),
m_isPassmark(false),
m_saBefore(-1),
m_saAfter(-1),
m_formulaWidthBefore(currentSeamAllowance),
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength)
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward)
{}
VPieceNodeData(quint32 id, Tool typeTool, bool reverse)
@ -56,11 +59,14 @@ public:
m_typeTool(typeTool),
m_reverse(reverse),
m_excluded(false),
m_isPassmark(false),
m_saBefore(-1),
m_saAfter(-1),
m_formulaWidthBefore(currentSeamAllowance),
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength)
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward)
{
if (m_typeTool == Tool::NodePoint)
{
@ -74,11 +80,14 @@ public:
m_typeTool(node.m_typeTool),
m_reverse(node.m_reverse),
m_excluded(node.m_excluded),
m_isPassmark(node.m_isPassmark),
m_saBefore(node.m_saBefore),
m_saAfter(node.m_saAfter),
m_formulaWidthBefore(node.m_formulaWidthBefore),
m_formulaWidthAfter(node.m_formulaWidthAfter),
m_angleType(node.m_angleType)
m_angleType(node.m_angleType),
m_passmarkLineType(node.m_passmarkLineType),
m_passmarkAngleType(node.m_passmarkAngleType)
{}
~VPieceNodeData();
@ -96,6 +105,9 @@ public:
* affect on main path. Also include to exist path items automatically setted excluded. */
bool m_excluded;
/** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */
bool m_isPassmark;
qreal m_saBefore;
qreal m_saAfter;
@ -104,6 +116,9 @@ public:
PieceNodeAngle m_angleType;
PassmarkLineType m_passmarkLineType;
PassmarkAngleType m_passmarkAngleType;
private:
VPieceNodeData &operator=(const VPieceNodeData &) Q_DECL_EQ_DELETE;
};

View File

@ -138,4 +138,5 @@ FORMS += \
$$PWD/tools/piece/tabs/tablabels.ui \
$$PWD/tools/piece/tabs/tabgrainline.ui \
$$PWD/tools/piece/tabs/tabpins.ui \
$$PWD/tools/dialoginsertnode.ui
$$PWD/tools/dialoginsertnode.ui \
$$PWD/tools/piece/tabs/tabpassmarks.ui

View File

@ -244,7 +244,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
{
rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ValidObjects(PathIsValid());
}

View File

@ -566,7 +566,7 @@ QFont DialogTool::NodeFont(bool nodeExcluded)
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogTool::GetNodeName(const VPieceNode &node) const
QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmark) const
{
const QSharedPointer<VGObject> obj = data->GetGObject(node.GetId());
QString name = obj->name();
@ -581,6 +581,23 @@ QString DialogTool::GetNodeName(const VPieceNode &node) const
name = QLatin1String("- ") + name;
}
}
else if (showPassmark && node.IsPassmark())
{
switch(node.GetPassmarkLineType())
{
case PassmarkLineType::OneLine:
name += QLatin1String("^");
break;
case PassmarkLineType::TwoLines:
name += QLatin1String("^^");
break;
case PassmarkLineType::ThreeLines:
name += QLatin1String("^^^");
break;
default:
break;
}
}
return name;
}
@ -598,7 +615,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
case (Tool::NodeElArc):
case (Tool::NodeSpline):
case (Tool::NodeSplinePath):
name = GetNodeName(node);
name = GetNodeName(node, true);
break;
default:
qDebug()<<"Got wrong tools. Ignore.";

View File

@ -274,7 +274,7 @@ protected:
static QString DialogWarningIcon();
static QFont NodeFont(bool nodeExcluded);
QString GetNodeName(const VPieceNode &node) const;
QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const;
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);
void InitNodeAngles(QComboBox *box);

View File

@ -32,6 +32,7 @@
#include "ui_tablabels.h"
#include "ui_tabgrainline.h"
#include "ui_tabpins.h"
#include "ui_tabpassmarks.h"
#include "../vwidgets/fancytabbar/fancytabbar.h"
#include "../vpatterndb/vpiecenode.h"
#include "../vpatterndb/vpiecepath.h"
@ -46,7 +47,7 @@
#include <QTimer>
#include <QtNumeric>
enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Count=4};
enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Passmarks=4, Count=5};
namespace
{
@ -80,10 +81,12 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
uiTabLabels(new Ui::TabLabels),
uiTabGrainline(new Ui::TabGrainline),
uiTabPins(new Ui::TabPins),
uiTabPassmarks(new Ui::TabPassmarks),
m_tabPaths(new QWidget),
m_tabLabels(new QWidget),
m_tabGrainline(new QWidget),
m_tabPins(new QWidget),
m_tabPassmarks(new QWidget),
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
dialogIsInitialized(false),
applyAllowed(false),// By default disabled
@ -135,6 +138,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
InitLabelsTab();
InitGrainlineTab();
InitPinsTab();
InitPassmarksTab();
flagName = true;//We have default name of piece.
ChangeColor(uiTabLabels->labelEditName, okColor);
@ -153,10 +157,12 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
DialogSeamAllowance::~DialogSeamAllowance()
{
delete m_visPins;
delete m_tabPassmarks;
delete m_tabPins;
delete m_tabGrainline;
delete m_tabLabels;
delete m_tabPaths;
delete uiTabPassmarks;
delete uiTabPins;
delete uiTabGrainline;
delete uiTabLabels;
@ -176,6 +182,7 @@ void DialogSeamAllowance::EnableApply(bool enable)
m_ftb->SetTabEnabled(TabOrder::Labels, applyAllowed);
m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed);
m_ftb->SetTabEnabled(TabOrder::Pins, applyAllowed);
m_ftb->SetTabEnabled(TabOrder::Passmarks, applyAllowed);
}
//---------------------------------------------------------------------------------------------------------------------
@ -579,6 +586,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
SCASSERT(rowItem != nullptr);
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
QAction *actionPassmark = nullptr;
QAction *actionReverse = nullptr;
if (rowNode.GetTypeTool() != Tool::NodePoint)
{
@ -586,6 +594,12 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
actionReverse->setCheckable(true);
actionReverse->setChecked(rowNode.GetReverse());
}
else
{
actionPassmark = menu->addAction(tr("Passmark"));
actionPassmark->setCheckable(true);
actionPassmark->setChecked(rowNode.IsPassmark());
}
QAction *actionExcluded = menu->addAction(tr("Excluded"));
actionExcluded->setCheckable(true);
@ -597,24 +611,28 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
if (selectedAction == actionDelete)
{
delete uiTabPaths->listWidgetMainPath->item(row);
ValidObjects(MainPathIsValid());
}
else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
{
rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
ValidObjects(MainPathIsValid());
rowItem->setText(GetNodeName(rowNode, true));
}
else if (selectedAction == actionExcluded)
{
rowNode.SetExcluded(not rowNode.IsExcluded());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
rowItem->setFont(NodeFont(rowNode.IsExcluded()));
ValidObjects(MainPathIsValid());
}
else if (selectedAction == actionPassmark)
{
rowNode.SetPassmark(not rowNode.IsPassmark());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
}
ValidObjects(MainPathIsValid());
ListChanged();
}
@ -736,6 +754,7 @@ void DialogSeamAllowance::ListChanged()
visPath->RefreshGeometry();
}
InitNodesList();
InitPassmarksList();
CustomSAChanged(uiTabPaths->listWidgetCustomSA->currentRow());
}
@ -820,6 +839,68 @@ void DialogSeamAllowance::NodeChanged(int index)
uiTabPaths->comboBoxAngle->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkChanged(int index)
{
uiTabPassmarks->radioButtonOneLine->setDisabled(true);
uiTabPassmarks->radioButtonTwoLines->setDisabled(true);
uiTabPassmarks->radioButtonThreeLines->setDisabled(true);
uiTabPassmarks->radioButtonStraightforward->setDisabled(true);
uiTabPassmarks->radioButtonBisector->setDisabled(true);
uiTabPassmarks->groupBoxLineType->blockSignals(true);
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
if (index != -1)
{
const VPiece piece = CreatePiece();
const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (nodeIndex != -1)
{
const VPieceNode &node = piece.GetPath().at(nodeIndex);
// Line type
uiTabPassmarks->radioButtonOneLine->setEnabled(true);
uiTabPassmarks->radioButtonTwoLines->setEnabled(true);
uiTabPassmarks->radioButtonThreeLines->setEnabled(true);
switch(node.GetPassmarkLineType())
{
case PassmarkLineType::OneLine:
uiTabPassmarks->radioButtonOneLine->setChecked(true);
break;
case PassmarkLineType::TwoLines:
uiTabPassmarks->radioButtonTwoLines->setChecked(true);
break;
case PassmarkLineType::ThreeLines:
uiTabPassmarks->radioButtonThreeLines->setChecked(true);
break;
default:
break;
}
// Angle type
uiTabPassmarks->radioButtonStraightforward->setEnabled(true);
uiTabPassmarks->radioButtonBisector->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
case PassmarkAngleType::Straightforward:
uiTabPassmarks->radioButtonStraightforward->setChecked(true);
break;
case PassmarkAngleType::Bisector:
uiTabPassmarks->radioButtonBisector->setChecked(true);
break;
default:
break;
}
}
}
uiTabPassmarks->groupBoxLineType->blockSignals(false);
uiTabPassmarks->groupBoxAngleType->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::CSAStartPointChanged(int index)
{
@ -1010,6 +1091,7 @@ void DialogSeamAllowance::FancyTabChanged(int index)
m_tabLabels->hide();
m_tabGrainline->hide();
m_tabPins->hide();
m_tabPassmarks->hide();
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
@ -1027,6 +1109,9 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
case TabOrder::Pins:
m_tabPins->show();
break;
case TabOrder::Passmarks:
m_tabPassmarks->show();
break;
}
QT_WARNING_POP
@ -1061,6 +1146,70 @@ void DialogSeamAllowance::TabChanged(int index)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkLineTypeChanged(int id)
{
const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
PassmarkLineType lineType = PassmarkLineType::OneLine;
if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonOneLine))
{
lineType = PassmarkLineType::OneLine;
}
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonTwoLines))
{
lineType = PassmarkLineType::TwoLines;
}
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonThreeLines))
{
lineType = PassmarkLineType::ThreeLines;
}
rowNode.SetPassmarkLineType(lineType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
{
const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonStraightforward))
{
angleType = PassmarkAngleType::Straightforward;
}
else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonBisector))
{
angleType = PassmarkAngleType::Bisector;
}
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::UpdateGrainlineValues()
{
@ -2109,6 +2258,40 @@ void DialogSeamAllowance::InitNodesList()
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitPassmarksList()
{
const quint32 id = CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt();
uiTabPassmarks->comboBoxPassmarks->blockSignals(true);
uiTabPassmarks->comboBoxPassmarks->clear();
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
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);
uiTabPassmarks->comboBoxPassmarks->addItem(name, node.GetId());
}
}
uiTabPassmarks->comboBoxPassmarks->blockSignals(false);
const int index = uiTabPassmarks->comboBoxPassmarks->findData(id);
if (index != -1)
{
uiTabPassmarks->comboBoxPassmarks->setCurrentIndex(index);
PassmarkChanged(index);// Need in case combox index was not changed
}
else
{
uiTabPassmarks->comboBoxPassmarks->count() > 0 ? PassmarkChanged(0) : PassmarkChanged(-1);
}
}
//---------------------------------------------------------------------------------------------------------------------
QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id)
{
@ -2194,6 +2377,7 @@ void DialogSeamAllowance::InitFancyTabBar()
m_ftb->InsertTab(TabOrder::Labels, QIcon("://icon/32x32/labels.png"), tr("Labels"));
m_ftb->InsertTab(TabOrder::Grainline, QIcon("://icon/32x32/grainline.png"), tr("Grainline"));
m_ftb->InsertTab(TabOrder::Pins, QIcon("://icon/32x32/pins.png"), tr("Pins"));
m_ftb->InsertTab(TabOrder::Passmarks, QIcon("://icon/32x32/passmark.png"), tr("Passmarks"));
ui->horizontalLayout->addWidget(m_ftb, 0, Qt::AlignLeft);
@ -2215,6 +2399,10 @@ void DialogSeamAllowance::InitFancyTabBar()
uiTabPins->setupUi(m_tabPins);
ui->horizontalLayout->addWidget(m_tabPins, 1);
m_tabPassmarks->hide();
uiTabPassmarks->setupUi(m_tabPassmarks);
ui->horizontalLayout->addWidget(m_tabPassmarks, 1);
connect(m_ftb, &FancyTabBar::CurrentChanged, this, &DialogSeamAllowance::FancyTabChanged);
connect(uiTabLabels->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged);
}
@ -2521,6 +2709,19 @@ void DialogSeamAllowance::InitPinsTab()
&DialogSeamAllowance::ShowPinsContextMenu);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitPassmarksTab()
{
InitPassmarksList();
connect(uiTabPassmarks->comboBoxPassmarks, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogSeamAllowance::PassmarkChanged);
connect(uiTabPassmarks->buttonGroupLineType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogSeamAllowance::PassmarkLineTypeChanged);
connect(uiTabPassmarks->buttonGroupAngleType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogSeamAllowance::PassmarkAngleTypeChanged);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitAllPinComboboxes()
{

View File

@ -42,6 +42,7 @@ namespace Ui
class TabLabels;
class TabGrainline;
class TabPins;
class TabPassmarks;
}
class VisPiecePins;
@ -90,6 +91,7 @@ private slots:
void ListChanged();
void EnableSeamAllowance(bool enable);
void NodeChanged(int index);
void PassmarkChanged(int index);
void CSAStartPointChanged(int index);
void CSAEndPointChanged(int index);
void CSAIncludeTypeChanged(int index);
@ -100,6 +102,8 @@ private slots:
void PathDialogClosed(int result);
void FancyTabChanged(int index);
void TabChanged(int index);
void PassmarkLineTypeChanged(int id);
void PassmarkAngleTypeChanged(int id);
void UpdateGrainlineValues();
void UpdateDetailLabelValues();
@ -158,11 +162,13 @@ private:
Ui::TabLabels *uiTabLabels;
Ui::TabGrainline *uiTabGrainline;
Ui::TabPins *uiTabPins;
Ui::TabPassmarks *uiTabPassmarks;
QWidget *m_tabPaths;
QWidget *m_tabLabels;
QWidget *m_tabGrainline;
QWidget *m_tabPins;
QWidget *m_tabPassmarks;
FancyTabBar* m_ftb;
@ -236,6 +242,7 @@ private:
void InitMainPathTab();
void InitSeamAllowanceTab();
void InitNodesList();
void InitPassmarksList();
void InitCSAPoint(QComboBox *box);
void InitPinPoint(QComboBox *box);
void InitSAIncludeType();
@ -244,6 +251,7 @@ private:
void InitLabelsTab();
void InitGrainlineTab();
void InitPinsTab();
void InitPassmarksTab();
void InitAllPinComboboxes();
void SetFormulaSAWidth(const QString &formula);

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TabPassmarks</class>
<widget class="QWidget" name="TabPassmarks">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>208</width>
<height>285</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout">
<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">
<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_2">
<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">
<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>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupLineType"/>
<buttongroup name="buttonGroupAngleType"/>
</buttongroups>
</ui>