Dialog Seam allowance tool. Show pins in a list.
--HG-- branch : feature
This commit is contained in:
parent
71ac49a221
commit
fc86069f7c
|
@ -99,6 +99,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
InitInternalPathsTab();
|
InitInternalPathsTab();
|
||||||
InitPatternPieceDataTab();
|
InitPatternPieceDataTab();
|
||||||
InitGrainlineTab();
|
InitGrainlineTab();
|
||||||
|
InitPinsTab();
|
||||||
|
|
||||||
flagName = true;//We have default name of piece.
|
flagName = true;//We have default name of piece.
|
||||||
ChangeColor(ui->labelEditName, okColor);
|
ChangeColor(ui->labelEditName, okColor);
|
||||||
|
@ -129,6 +130,7 @@ void DialogSeamAllowance::EnableApply(bool enable)
|
||||||
ui->tabInternalPaths->setEnabled(applyAllowed);
|
ui->tabInternalPaths->setEnabled(applyAllowed);
|
||||||
ui->tabPatternPieceData->setEnabled(applyAllowed);
|
ui->tabPatternPieceData->setEnabled(applyAllowed);
|
||||||
ui->tabGrainline->setEnabled(applyAllowed);
|
ui->tabGrainline->setEnabled(applyAllowed);
|
||||||
|
ui->tabPins->setEnabled(applyAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -160,6 +162,12 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
NewInternalPath(piece.GetInternalPaths().at(i));
|
NewInternalPath(piece.GetInternalPaths().at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->listWidgetPins->clear();
|
||||||
|
for (int i = 0; i < piece.GetPins().size(); ++i)
|
||||||
|
{
|
||||||
|
NewPin(piece.GetPins().at(i));
|
||||||
|
}
|
||||||
|
|
||||||
ui->comboBoxStartPoint->blockSignals(true);
|
ui->comboBoxStartPoint->blockSignals(true);
|
||||||
ui->comboBoxStartPoint->clear();
|
ui->comboBoxStartPoint->clear();
|
||||||
ui->comboBoxStartPoint->blockSignals(false);
|
ui->comboBoxStartPoint->blockSignals(false);
|
||||||
|
@ -598,6 +606,25 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos)
|
||||||
|
{
|
||||||
|
const int row = ui->listWidgetPins->currentRow();
|
||||||
|
if (ui->listWidgetPins->count() == 0 || row == -1 || row >= ui->listWidgetPins->count())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu *menu = new QMenu(this);
|
||||||
|
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
|
|
||||||
|
QAction *selectedAction = menu->exec(ui->listWidgetPins->viewport()->mapToGlobal(pos));
|
||||||
|
if (selectedAction == actionDelete)
|
||||||
|
{
|
||||||
|
delete ui->listWidgetPins->item(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ListChanged()
|
void DialogSeamAllowance::ListChanged()
|
||||||
{
|
{
|
||||||
|
@ -1271,6 +1298,14 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
||||||
}
|
}
|
||||||
piece.SetInternalPaths(iPaths);
|
piece.SetInternalPaths(iPaths);
|
||||||
|
|
||||||
|
QVector<quint32> pins;
|
||||||
|
for (qint32 i = 0; i < ui->listWidgetPins->count(); ++i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = ui->listWidgetPins->item(i);
|
||||||
|
pins.append(qvariant_cast<quint32>(item->data(Qt::UserRole)));
|
||||||
|
}
|
||||||
|
piece.SetPins(pins);
|
||||||
|
|
||||||
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
|
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
|
||||||
piece.SetSeamAllowance(ui->checkBoxSeams->isChecked());
|
piece.SetSeamAllowance(ui->checkBoxSeams->isChecked());
|
||||||
piece.SetName(ui->lineEditName->text());
|
piece.SetName(ui->lineEditName->text());
|
||||||
|
@ -1344,6 +1379,21 @@ void DialogSeamAllowance::NewInternalPath(quint32 path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::NewPin(quint32 pinPoint)
|
||||||
|
{
|
||||||
|
if (pinPoint > NULL_ID)
|
||||||
|
{
|
||||||
|
const QSharedPointer<VGObject> pin = data->GetGObject(pinPoint);
|
||||||
|
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(pin->name());
|
||||||
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(pinPoint));
|
||||||
|
ui->listWidgetPins->addItem(item);
|
||||||
|
ui->listWidgetPins->setCurrentRow(ui->listWidgetPins->count()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
||||||
{
|
{
|
||||||
|
@ -1727,6 +1777,14 @@ void DialogSeamAllowance::InitGrainlineTab()
|
||||||
m_iLenBaseHeight = ui->lineEditLenFormula->height();
|
m_iLenBaseHeight = ui->lineEditLenFormula->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPinsTab()
|
||||||
|
{
|
||||||
|
ui->listWidgetPins->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(ui->listWidgetPins, &QListWidget::customContextMenuRequested, this,
|
||||||
|
&DialogSeamAllowance::ShowPinsContextMenu);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogSeamAllowance::GetFormulaSAWidth() const
|
QString DialogSeamAllowance::GetFormulaSAWidth() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,6 +77,7 @@ private slots:
|
||||||
void ShowMainPathContextMenu(const QPoint &pos);
|
void ShowMainPathContextMenu(const QPoint &pos);
|
||||||
void ShowCustomSAContextMenu(const QPoint &pos);
|
void ShowCustomSAContextMenu(const QPoint &pos);
|
||||||
void ShowInternalPathsContextMenu(const QPoint &pos);
|
void ShowInternalPathsContextMenu(const QPoint &pos);
|
||||||
|
void ShowPinsContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
void ListChanged();
|
void ListChanged();
|
||||||
void EnableSeamAllowance(bool enable);
|
void EnableSeamAllowance(bool enable);
|
||||||
|
@ -150,6 +151,7 @@ private:
|
||||||
void NewMainPathItem(const VPieceNode &node);
|
void NewMainPathItem(const VPieceNode &node);
|
||||||
void NewCustomSA(const CustomSARecord &record);
|
void NewCustomSA(const CustomSARecord &record);
|
||||||
void NewInternalPath(quint32 path);
|
void NewInternalPath(quint32 path);
|
||||||
|
void NewPin(quint32 pinPoint);
|
||||||
QString GetPathName(quint32 path, bool reverse = false) const;
|
QString GetPathName(quint32 path, bool reverse = false) const;
|
||||||
bool MainPathIsValid() const;
|
bool MainPathIsValid() const;
|
||||||
void ValidObjects(bool value);
|
void ValidObjects(bool value);
|
||||||
|
@ -176,6 +178,7 @@ private:
|
||||||
void InitInternalPathsTab();
|
void InitInternalPathsTab();
|
||||||
void InitPatternPieceDataTab();
|
void InitPatternPieceDataTab();
|
||||||
void InitGrainlineTab();
|
void InitGrainlineTab();
|
||||||
|
void InitPinsTab();
|
||||||
|
|
||||||
void SetFormulaSAWidth(const QString &formula);
|
void SetFormulaSAWidth(const QString &formula);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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">
|
||||||
|
@ -1527,6 +1527,20 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabPins">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Pins</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidgetPins">
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::InternalMove</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user