This commit is contained in:
parent
8123c67e7c
commit
c47664d86c
|
@ -11,6 +11,7 @@
|
|||
- Improve multisize measurements format. Allow excluding combinations inside min/max range.
|
||||
- New warning. Grainline is not valid.
|
||||
- [smart-pattern/valentina#87] Add support for TIFF format.
|
||||
- [smart-pattern/valentina#88] Allow insertion of multiple nodes by setting their number.
|
||||
|
||||
# Version 0.7.41 Dec 4, 2020
|
||||
- Bug fixes.
|
||||
|
|
|
@ -48,6 +48,9 @@ DialogInsertNode::DialogInsertNode(const VContainer *data, quint32 toolId, QWidg
|
|||
});
|
||||
|
||||
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogInsertNode::ShowContextMenu);
|
||||
connect(ui->listWidget, &QListWidget::itemSelectionChanged, this, &DialogInsertNode::NodeSelected);
|
||||
connect(ui->spinBoxNodeNumber, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||
&DialogInsertNode::NodeNumberChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -101,7 +104,11 @@ QVector<VPieceNode> DialogInsertNode::GetNodes() const
|
|||
QVector<VPieceNode> nodes;
|
||||
for (qint32 i = 0; i < ui->listWidget->count(); ++i)
|
||||
{
|
||||
nodes.append(qvariant_cast<VPieceNode>(ui->listWidget->item(i)->data(Qt::UserRole)));
|
||||
VPieceNode node = qvariant_cast<VPieceNode>(ui->listWidget->item(i)->data(Qt::UserRole));
|
||||
for(int n = 1; n <= nodeNumbers.value(node.GetId(), 1); ++n)
|
||||
{
|
||||
nodes.append(node);
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
@ -224,6 +231,41 @@ void DialogInsertNode::ShowContextMenu(const QPoint &pos)
|
|||
CheckNodes();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogInsertNode::NodeSelected()
|
||||
{
|
||||
QListWidgetItem *item = ui->listWidget->currentItem();
|
||||
|
||||
if (item == nullptr)
|
||||
{
|
||||
ui->spinBoxNodeNumber->setDisabled(true);
|
||||
ui->spinBoxNodeNumber->blockSignals(true);
|
||||
ui->spinBoxNodeNumber->setValue(1);
|
||||
ui->spinBoxNodeNumber->blockSignals(false);
|
||||
return;
|
||||
}
|
||||
|
||||
VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||
ui->spinBoxNodeNumber->setEnabled(true);
|
||||
ui->spinBoxNodeNumber->blockSignals(true);
|
||||
ui->spinBoxNodeNumber->setValue(nodeNumbers.value(node.GetId(), 1));
|
||||
ui->spinBoxNodeNumber->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogInsertNode::NodeNumberChanged(int val)
|
||||
{
|
||||
QListWidgetItem *item = ui->listWidget->currentItem();
|
||||
|
||||
if (item == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||
nodeNumbers[node.GetId()] = val;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogInsertNode::CheckPieces()
|
||||
{
|
||||
|
|
|
@ -62,6 +62,8 @@ protected:
|
|||
|
||||
private slots:
|
||||
void ShowContextMenu(const QPoint &pos);
|
||||
void NodeSelected();
|
||||
void NodeNumberChanged(int val);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogInsertNode)
|
||||
|
@ -71,6 +73,8 @@ private:
|
|||
bool m_flagNodes{false};
|
||||
bool m_flagError{false};
|
||||
|
||||
QMap<quint32, int> nodeNumbers{};
|
||||
|
||||
void CheckPieces();
|
||||
void CheckNodes();
|
||||
};
|
||||
|
|
|
@ -26,16 +26,33 @@
|
|||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPiece">
|
||||
<property name="text">
|
||||
<string>Piece:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxPiece"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelNumber">
|
||||
<property name="text">
|
||||
<string>Number:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxNodeNumber">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user