MCPcopy Create free account
hub / github.com/KDE/labplot / loadThemeConfig

Method loadThemeConfig

src/backend/worksheet/plots/cartesian/ReferenceRange.cpp:607–635  ·  view source on GitHub ↗

############################################################################## ######################### Theme management ################################## ##############################################################################

Source from the content-addressed store, hash-verified

605// ######################### Theme management ##################################
606// ##############################################################################
607void ReferenceRange::loadThemeConfig(const KConfig& config) {
608 // determine the index of the current range in the list of all range children
609 // and apply the theme color for this index
610 const auto* plot = dynamic_cast<const CartesianPlot*>(parentAspect());
611 if (!plot)
612 return;
613
614 int index = 0;
615 const auto& children = plot->children<WorksheetElement>();
616 for (auto* child : children) {
617 if (child == this)
618 break;
619
620 if (child->inherits(AspectType::ReferenceRange))
621 ++index;
622 }
623
624 const auto& themeColor = plot->themeColorPalette(index);
625
626 KConfigGroup group;
627 if (config.hasGroup(QStringLiteral("Theme")))
628 group = config.group(QStringLiteral("Axis")); // when loading from the theme config, use the same properties as for Axis
629 else
630 group = config.group(QStringLiteral("ReferenceRange"));
631
632 Q_D(ReferenceRange);
633 d->line->loadThemeConfig(group);
634 d->background->loadThemeConfig(group, themeColor);
635}

Callers

nothing calls this directly

Calls 3

inheritsMethod · 0.80
themeColorPaletteMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected