diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index f57f27ec5e..04552116c9 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -350,11 +350,15 @@ void FaceColors::on_defaultButton_clicked() void FaceColors::on_colorButton_changed() { if (!d->index.isEmpty()) { - QColor c = d->ui->colorButton->color(); + QColor color = d->ui->colorButton->color(); for (QSet::iterator it = d->index.begin(); it != d->index.end(); ++it) { - d->perface[*it].set(c.redF(), c.greenF(), c.blueF(), c.alphaF()); + // alpha of App::Color is contrary to the one of QColor + d->perface[*it].set(color.redF(), color.greenF(), color.blueF(), (1.0 - color.alphaF())); } d->vp->DiffuseColor.setValues(d->perface); + // new color has been applied, unselect so that users can see this + onSelectionChanged(Gui::SelectionChanges::ClrSelection); + Gui::Selection().clearSelection(); } } @@ -373,9 +377,10 @@ void FaceColors::onSelectionChanged(const Gui::SelectionChanges& msg) if (docname == msg.pDocName && objname == msg.pObjectName) { int index = std::atoi(msg.pSubName + 4) - 1; d->index.insert(index); - const App::Color& c = d->perface[index]; + const App::Color& faceColor = d->perface[index]; QColor color; - color.setRgbF(c.r, c.g, c.b, c.a); + // alpha of App::Color is contrary to the one of QColor + color.setRgbF(faceColor.r, faceColor.g, faceColor.b, (1.0 - faceColor.a)); d->ui->colorButton->setColor(color); selection_changed = true; } diff --git a/src/Mod/Part/Gui/TaskFaceColors.h b/src/Mod/Part/Gui/TaskFaceColors.h index 4505a0f7d2..ebf7645e58 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.h +++ b/src/Mod/Part/Gui/TaskFaceColors.h @@ -20,12 +20,11 @@ * * ***************************************************************************/ - #ifndef PARTGUI_TASKSETCOLORS_H #define PARTGUI_TASKSETCOLORS_H -#include #include +#include namespace Gui { class Document; diff --git a/src/Mod/Part/Gui/TaskFaceColors.ui b/src/Mod/Part/Gui/TaskFaceColors.ui index 2e08fa5178..c953016240 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.ui +++ b/src/Mod/Part/Gui/TaskFaceColors.ui @@ -7,7 +7,7 @@ 0 0 247 - 157 + 143