[PD] allow to move sweep sections

Now that we have the feature that sweeps can have vertices as end or begin of a sweep, there is the need for the feature to move sections. For example vertices may only be the last section.
This commit is contained in:
Uwe
2021-11-28 21:50:33 +01:00
parent 90f2040386
commit 625c84e34a
3 changed files with 35 additions and 3 deletions

View File

@@ -938,6 +938,9 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
connect(remove, SIGNAL(triggered()), this, SLOT(onDeleteSection()));
connect(ui->listWidgetReferences->model(),
SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved()));
this->groupLayout()->addWidget(proxy);
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(PipeView->getObject());
@@ -964,6 +967,27 @@ TaskPipeScaling::~TaskPipeScaling()
}
}
void TaskPipeScaling::indexesMoved()
{
QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
if (!model)
return;
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
auto originals = pipe->Sections.getSubListValues();
QByteArray name;
int rows = model->rowCount();
for (int i = 0; i < rows; i++) {
QModelIndex index = model->index(i, 0);
originals[i] = index.data(Qt::UserRole).value<App::PropertyLinkSubList::SubSet>();
}
pipe->Sections.setSubListValues(originals);
recomputeFeature();
updateUI(ui->stackedWidget->currentIndex());
}
void TaskPipeScaling::clearButtons(const selectionModes notThis)
{
// TODO: Clear buttons in the other pipe taskboxes as well