From 0bda7f449feb482e7aef1aca246de1ceb983da3e Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 2 Aug 2020 20:32:18 +0200 Subject: [PATCH] [Part] FaceColors cleanup - indicate if one is in the Box Selection mode - get rid on dialog if one really wants to cancel (no other Task dialog does this and it is annoying) - fix clumsy dialog layout --- src/Mod/Part/Gui/TaskFaceColors.cpp | 27 +-- src/Mod/Part/Gui/TaskFaceColors.ui | 244 +++++++++++++++++----------- 2 files changed, 165 insertions(+), 106 deletions(-) diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index 4a18acb368..80e6e94309 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -257,6 +257,7 @@ public: self->d->boxSelection = true; self->d->addFacesToSelection(view, proj, polygon, shape); self->d->boxSelection = false; + self->d->ui->boxSelection->setChecked(false); self->updatePanel(); view->redraw(); } @@ -323,7 +324,16 @@ void FaceColors::slotDeleteObject(const Gui::ViewProvider& obj) void FaceColors::on_boxSelection_clicked() { Gui::View3DInventor* view = qobject_cast(Gui::getMainWindow()->activeWindow()); - if (view) { + // toggle the button state and feature + if (d->boxSelection) { + d->boxSelection = false; + d->ui->boxSelection->setChecked(false); + } + else { + d->boxSelection = true; + d->ui->boxSelection->setChecked(true); + } + if (view && d->boxSelection) { Gui::View3DInventorViewer* viewer = view->getViewer(); if (!viewer->isSelecting()) { viewer->startSelection(Gui::View3DInventorViewer::Rubberband); @@ -434,17 +444,10 @@ bool FaceColors::accept() bool FaceColors::reject() { - int ret = QMessageBox::question(this, tr("Face colors"), tr("Do you really want to cancel?"), - QMessageBox::Yes, QMessageBox::No|QMessageBox::Default|QMessageBox::Escape); - if (ret == QMessageBox::Yes) { - Gui::Document* doc = Gui::Application::Instance->getDocument(d->vp->getObject()->getDocument()); - doc->abortCommand(); - doc->resetEdit(); - return true; - } - else { - return false; - } + Gui::Document* doc = Gui::Application::Instance->getDocument(d->vp->getObject()->getDocument()); + doc->abortCommand(); + doc->resetEdit(); + return true; } void FaceColors::changeEvent(QEvent *e) diff --git a/src/Mod/Part/Gui/TaskFaceColors.ui b/src/Mod/Part/Gui/TaskFaceColors.ui index 4ce48b8201..7edcf74830 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.ui +++ b/src/Mod/Part/Gui/TaskFaceColors.ui @@ -1,94 +1,150 @@ - - - PartGui::TaskFaceColors - - - - 0 - 0 - 247 - 219 - - - - Set color per face - - - - - - Click on the faces in the 3d view to select them. - - - - - - - Group box - - - - - - - 0 - 0 - - - - Faces: - - - - - - - [] - - - - - - - - - - - - - Set to default - - - - - - - Box selection - - - - - - - Qt::Vertical - - - - 20 - 135 - - - - - - - - - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
-
- - -
+ + + PartGui::TaskFaceColors + + + + 0 + 0 + 247 + 157 + + + + Set color per face + + + + + + Click on the faces in the 3D view to select them + + + + + + + + + Group box + + + + + + + 0 + 0 + + + + Faces: + + + + + + + [] + + + + + + + + 146 + 0 + + + + + 160 + 16777215 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Resets color for all faces of the part + + + Set to default + + + + + + + When checked, the you can select multiple faces +by dragging a selection rectangle in the 3D view + + + Box selection + + + true + + + false + + + false + + + false + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+
+ + +