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 145af5cddc
commit a72a63232a
215 changed files with 1057 additions and 1054 deletions

View File

@@ -378,7 +378,7 @@ void QGIViewPart::drawAllEdges()
// geometry edge - apply format if applicable
TechDraw::GeomFormat* gf = dvp->getGeomFormatBySelection(iEdge);
if (gf) {
App::Color color = Preferences::getAccessibleColor(gf->m_format.getColor());
Base::Color color = Preferences::getAccessibleColor(gf->m_format.getColor());
item->setNormalColor(color.asValue<QColor>());
int lineNumber = gf->m_format.getLineNumber();
int qtStyle = gf->m_format.getStyle();
@@ -542,7 +542,7 @@ bool QGIViewPart::formatGeomFromCosmetic(std::string cTag, QGIEdge* item)
auto partFeat(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
TechDraw::CosmeticEdge* ce = partFeat ? partFeat->getCosmeticEdge(cTag) : nullptr;
if (ce) {
App::Color color = Preferences::getAccessibleColor(ce->m_format.getColor());
Base::Color color = Preferences::getAccessibleColor(ce->m_format.getColor());
item->setNormalColor(color.asValue<QColor>());
item->setLinePen(m_dashedLineGenerator->getBestPen(ce->m_format.getLineNumber(),
(Qt::PenStyle)ce->m_format.getStyle(),
@@ -561,7 +561,7 @@ bool QGIViewPart::formatGeomFromCenterLine(std::string cTag, QGIEdge* item)
auto partFeat(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
TechDraw::CenterLine* cl = partFeat ? partFeat->getCenterLine(cTag) : nullptr;
if (cl) {
App::Color color = Preferences::getAccessibleColor(cl->m_format.getColor());
Base::Color color = Preferences::getAccessibleColor(cl->m_format.getColor());
item->setNormalColor(color.asValue<QColor>());
item->setLinePen(m_dashedLineGenerator->getBestPen(cl->m_format.getLineNumber(),
(Qt::PenStyle)cl->m_format.getStyle(),
@@ -722,7 +722,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
QGISectionLine* sectionLine = new QGISectionLine();
addToGroup(sectionLine);
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
Base::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
sectionLine->setSectionColor(color.asValue<QColor>());
sectionLine->setPathMode(false);
@@ -817,7 +817,7 @@ void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection,
QGISectionLine* sectionLine = new QGISectionLine();
addToGroup(sectionLine);
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
Base::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
sectionLine->setSectionColor(color.asValue<QColor>());
sectionLine->setPathMode(true);
sectionLine->setPath(wirePath);
@@ -956,7 +956,7 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
scene()->addItem(highlight);
highlight->setReference(viewDetail->Reference.getValue());
App::Color color = Preferences::getAccessibleColor(vp->HighlightLineColor.getValue());
Base::Color color = Preferences::getAccessibleColor(vp->HighlightLineColor.getValue());
highlight->setColor(color.asValue<QColor>());
highlight->setFeatureName(viewDetail->getNameInDocument());
highlight->setInteractive(true);
@@ -1063,7 +1063,7 @@ void QGIViewPart::drawBreakLines()
breakLine->setWidth(Rez::guiX(vp->HiddenWidth.getValue()));
breakLine->setBreakType(breakType);
breakLine->setZValue(ZVALUE::SECTIONLINE);
App::Color color = prefBreaklineColor();
Base::Color color = prefBreaklineColor();
breakLine->setBreakColor(color.asValue<QColor>());
breakLine->setRotation(-dbv->Rotation.getValue());
breakLine->draw();
@@ -1197,7 +1197,7 @@ bool QGIViewPart::prefPrintCenters()
return printCenters;
}
App::Color QGIViewPart::prefBreaklineColor()
Base::Color QGIViewPart::prefBreaklineColor()
{
return Preferences::getAccessibleColor(PreferencesGui::breaklineColor());
}