[Surface] Allow modal adding/removal of geometric entities

This commit is contained in:
Ajinkya Dahale
2022-05-22 19:56:15 +05:30
committed by wwmayer
parent 3376e387da
commit 80f28a4821
15 changed files with 231 additions and 51 deletions

View File

@@ -124,6 +124,12 @@ FillingEdgePanel::FillingEdgePanel(ViewProviderFilling* vp, Surface::Filling* ob
checkCommand = true;
setEditedObject(obj);
// Set up button group
buttonGroup = new Gui::ButtonGroup(this);
buttonGroup->setExclusive(true);
buttonGroup->addButton(ui->buttonUnboundEdgeAdd, (int)SelectionMode::AppendEdge);
buttonGroup->addButton(ui->buttonUnboundEdgeRemove, (int)SelectionMode::RemoveEdge);
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
action->setShortcut(QString::fromLatin1("Del"));
@@ -286,18 +292,28 @@ bool FillingEdgePanel::reject()
return true;
}
void FillingEdgePanel::on_buttonUnboundEdgeAdd_clicked()
void FillingEdgePanel::on_buttonUnboundEdgeAdd_toggled(bool checked)
{
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
selectionMode = AppendEdge;
if (checked) {
selectionMode = AppendEdge;
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
}
else if (selectionMode == AppendEdge) {
exitSelectionMode();
}
}
void FillingEdgePanel::on_buttonUnboundEdgeRemove_clicked()
void FillingEdgePanel::on_buttonUnboundEdgeRemove_toggled(bool checked)
{
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
selectionMode = RemoveEdge;
if (checked) {
selectionMode = RemoveEdge;
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
}
else if (selectionMode == RemoveEdge) {
exitSelectionMode();
}
}
void FillingEdgePanel::on_listUnbound_itemDoubleClicked(QListWidgetItem* item)
@@ -590,4 +606,11 @@ void FillingEdgePanel::modifyBoundary(bool on)
}
}
void FillingEdgePanel::exitSelectionMode()
{
// 'selectionMode' is passed by reference to the filter and changed when the filter is deleted
Gui::Selection().clearSelection();
Gui::Selection().rmvSelectionGate();
}
#include "moc_TaskFillingEdge.cpp"