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

@@ -117,12 +117,6 @@ FillingVertexPanel::FillingVertexPanel(ViewProviderFilling* vp, Surface::Filling
checkCommand = true;
setEditedObject(obj);
// Set up button group
buttonGroup = new Gui::ButtonGroup(this);
buttonGroup->setExclusive(true);
buttonGroup->addButton(ui->buttonVertexAdd, (int)SelectionMode::AppendVertex);
buttonGroup->addButton(ui->buttonVertexRemove, (int)SelectionMode::RemoveVertex);
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
action->setShortcut(QString::fromLatin1("Del"));
@@ -142,6 +136,12 @@ FillingVertexPanel::~FillingVertexPanel()
Gui::Selection().rmvSelectionGate();
}
void FillingVertexPanel::appendButtons(Gui::ButtonGroup* buttonGroup)
{
buttonGroup->addButton(ui->buttonVertexAdd, int(SelectionMode::AppendVertex));
buttonGroup->addButton(ui->buttonVertexRemove, int(SelectionMode::RemoveVertex));
}
// stores object pointer, its old fill type and adjusts radio buttons according to it.
void FillingVertexPanel::setEditedObject(Surface::Filling* obj)
{
@@ -233,9 +233,9 @@ void FillingVertexPanel::slotDeletedObject(const Gui::ViewProviderDocumentObject
void FillingVertexPanel::on_buttonVertexAdd_toggled(bool checked)
{
if (checked) {
selectionMode = AppendVertex;
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new VertexSelection(selectionMode, editedObject));
selectionMode = AppendVertex;
}
else if (selectionMode == AppendVertex) {
exitSelectionMode();
@@ -245,9 +245,9 @@ void FillingVertexPanel::on_buttonVertexAdd_toggled(bool checked)
void FillingVertexPanel::on_buttonVertexRemove_toggled(bool checked)
{
if (checked) {
selectionMode = RemoveVertex;
// 'selectionMode' is passed by reference and changed when the filter is deleted
Gui::Selection().addSelectionGate(new VertexSelection(selectionMode, editedObject));
selectionMode = RemoveVertex;
}
else if (selectionMode == RemoveVertex) {
exitSelectionMode();