Base: Move App::Color to Base

Every basic data type is stored in Base module, color is standing out as
one that does not. Moving it to Base opens possibilities to integrate it
better with the rest of FreeCAD.
This commit is contained in:
Kacper Donat
2025-02-15 22:58:19 +01:00
parent 0ba52f0e22
commit 13fbab9e42
215 changed files with 1057 additions and 1054 deletions

View File

@@ -64,7 +64,7 @@ public:
bool hasElementColor = false;
for (const auto& view : views) {
if (auto* prop = dynamic_cast<App::PropertyColor*>(view->getPropertyByName(property))) {
App::Color color = prop->getValue();
Base::Color color = prop->getValue();
QSignalBlocker block(buttonColor);
buttonColor->setColor(color.asValue<QColor>());
hasElementColor = true;
@@ -83,7 +83,7 @@ public:
for (const auto& view : views) {
if (auto* prop =
dynamic_cast<App::PropertyMaterial*>(view->getPropertyByName(property))) {
App::Color color = prop->getDiffuseColor();
Base::Color color = prop->getDiffuseColor();
QSignalBlocker block(buttonColor);
buttonColor->setColor(color.asValue<QColor>());
hasElementColor = true;
@@ -310,7 +310,7 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
}
std::string prop_name = name;
if (prop.is<App::PropertyColor>()) {
App::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
Base::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
if (prop_name == "LineColor") {
bool blocked = d->ui.buttonLineColor->blockSignals(true);
d->ui.buttonLineColor->setColor(value.asValue<QColor>());
@@ -479,7 +479,7 @@ void DlgDisplayPropertiesImp::onButtonLineColorChanged()
{
std::vector<Gui::ViewProvider*> Provider = getSelection();
QColor s = d->ui.buttonLineColor->color();
App::Color c {};
Base::Color c {};
c.setValue<QColor>(s);
for (auto it : Provider) {
if (auto* prop = dynamic_cast<App::PropertyColor*>(it->getPropertyByName("LineColor"))) {
@@ -492,7 +492,7 @@ void DlgDisplayPropertiesImp::onButtonPointColorChanged()
{
std::vector<Gui::ViewProvider*> Provider = getSelection();
QColor s = d->ui.buttonPointColor->color();
App::Color c {};
Base::Color c {};
c.setValue<QColor>(s);
for (auto it : Provider) {
if (auto* prop = dynamic_cast<App::PropertyColor*>(it->getPropertyByName("PointColor"))) {