diff --git a/src/Mod/Surface/Gui/TaskFilling.cpp b/src/Mod/Surface/Gui/TaskFilling.cpp index afdcd0add1..e9ec391cef 100644 --- a/src/Mod/Surface/Gui/TaskFilling.cpp +++ b/src/Mod/Surface/Gui/TaskFilling.cpp @@ -275,6 +275,9 @@ FillingPanel::FillingPanel(ViewProviderFilling* vp, Surface::Filling* obj) ui->listBoundary->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onDeleteEdge())); ui->listBoundary->setContextMenuPolicy(Qt::ActionsContextMenu); + + connect(ui->listBoundary->model(), + SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(onIndexesMoved())); } /* @@ -379,6 +382,11 @@ void FillingPanel::open() this->vp->highlightReferences(ViewProviderFilling::Face, links, true); Gui::Selection().clearSelection(); + + // if the surface is not yet created then automatically start "AppendEdge" mode + if (editedObject->Shape.getShape().isNull()) { + on_buttonEdgeAdd_clicked(); + } } void FillingPanel::clearSelection() @@ -744,6 +752,42 @@ void FillingPanel::onDeleteEdge() } } +void FillingPanel::onIndexesMoved() +{ + QAbstractItemModel* model = qobject_cast(sender()); + if (!model) + return; + + std::vector objects; + std::vector element; + std::vector faces; + std::vector order; + + int rows = model->rowCount(); + for (int i = 0; i < rows; i++) { + QModelIndex index = model->index(i, 0); + QList data; + data = index.data(Qt::UserRole).toList(); + + App::Document* doc = App::GetApplication().getDocument(data[0].toByteArray()); + App::DocumentObject* obj = doc ? doc->getObject(data[1].toByteArray()) : nullptr; + std::string sub = data[2].toByteArray().constData(); + std::string face = data[3].toByteArray().constData(); + long cont = data[4].toInt(); + + objects.push_back(obj); + element.push_back(sub); + + faces.push_back(face); + order.push_back(cont); + } + + editedObject->BoundaryEdges.setValues(objects, element); + editedObject->BoundaryFaces.setValues(faces); + editedObject->BoundaryOrder.setValues(order); + editedObject->recomputeFeature(); +} + void FillingPanel::on_buttonAccept_clicked() { QListWidgetItem* item = ui->listBoundary->currentItem(); diff --git a/src/Mod/Surface/Gui/TaskFilling.h b/src/Mod/Surface/Gui/TaskFilling.h index 9a0431adb4..5d5d825444 100644 --- a/src/Mod/Surface/Gui/TaskFilling.h +++ b/src/Mod/Surface/Gui/TaskFilling.h @@ -101,6 +101,7 @@ private Q_SLOTS: void on_buttonAccept_clicked(); void on_buttonIgnore_clicked(); void onDeleteEdge(void); + void onIndexesMoved(); void clearSelection(); }; diff --git a/src/Mod/Surface/Gui/TaskFilling.ui b/src/Mod/Surface/Gui/TaskFilling.ui index 9a5d8d1619..4225d8469b 100644 --- a/src/Mod/Surface/Gui/TaskFilling.ui +++ b/src/Mod/Surface/Gui/TaskFilling.ui @@ -48,7 +48,14 @@ - + + + List can be reordered by dragging + + + QAbstractItemView::InternalMove + +