[Part] fix TaskFaceColors dialog

fixes these issues:
- the actual or chosen color is never displayed in the dialog's color button (it was there but with zero transparency)
- after a color has been set one does not see it (because the changed faces were still highlighted and got the highlight color)
This commit is contained in:
Uwe
2022-03-20 05:41:34 +01:00
parent a999a249e3
commit d355b9d9e2
3 changed files with 11 additions and 7 deletions

View File

@@ -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<int>::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;
}

View File

@@ -20,12 +20,11 @@
* *
***************************************************************************/
#ifndef PARTGUI_TASKSETCOLORS_H
#define PARTGUI_TASKSETCOLORS_H
#include <Gui/TaskView/TaskView.h>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
namespace Gui {
class Document;

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>247</width>
<height>157</height>
<height>143</height>
</rect>
</property>
<property name="windowTitle">