Surface: use a single button group for all task boxes

This commit is contained in:
wmayer
2022-12-20 17:57:18 +01:00
parent 8310d0e2cb
commit 996839c263
6 changed files with 36 additions and 27 deletions

View File

@@ -125,12 +125,6 @@ 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"));
@@ -150,6 +144,12 @@ FillingEdgePanel::~FillingEdgePanel()
Gui::Selection().rmvSelectionGate();
}
void FillingEdgePanel::appendButtons(Gui::ButtonGroup* buttonGroup)
{
buttonGroup->addButton(ui->buttonUnboundEdgeAdd, int(SelectionMode::AppendEdge));
buttonGroup->addButton(ui->buttonUnboundEdgeRemove, int(SelectionMode::RemoveEdge));
}
// stores object pointer, its old fill type and adjusts radio buttons according to it.
void FillingEdgePanel::setEditedObject(Surface::Filling* fea)
{
@@ -296,9 +296,9 @@ bool FillingEdgePanel::reject()
void FillingEdgePanel::on_buttonUnboundEdgeAdd_toggled(bool checked)
{
if (checked) {
selectionMode = AppendEdge;
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
selectionMode = AppendEdge;
}
else if (selectionMode == AppendEdge) {
exitSelectionMode();
@@ -308,9 +308,9 @@ void FillingEdgePanel::on_buttonUnboundEdgeAdd_toggled(bool checked)
void FillingEdgePanel::on_buttonUnboundEdgeRemove_toggled(bool checked)
{
if (checked) {
selectionMode = RemoveEdge;
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
selectionMode = RemoveEdge;
}
else if (selectionMode == RemoveEdge) {
exitSelectionMode();