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

Method loadThemeConfig

src/backend/worksheet/plots/cartesian/BoxPlot.cpp:1962–2026  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1960// ######################### Theme management ##################################
1961// ##############################################################################
1962void BoxPlot::loadThemeConfig(const KConfig& config) {
1963 KConfigGroup group;
1964 if (config.hasGroup(QStringLiteral("Theme")))
1965 group = config.group(QStringLiteral("XYCurve")); // when loading from the theme config, use the same properties as for XYCurve
1966 else
1967 group = config.group(QStringLiteral("BoxPlot"));
1968
1969 Q_D(BoxPlot);
1970 const auto* plot = d->m_plot;
1971 int index = plot->curveChildIndex(this);
1972 const QColor themeColor = plot->themeColorPalette(index);
1973
1974 d->suppressRecalc = true;
1975
1976 for (int i = 0; i < d->dataColumns.count(); ++i) {
1977 const auto& color = plot->themeColorPalette(i);
1978
1979 // box fillings
1980 auto* background = d->backgrounds.at(i);
1981 background->loadThemeConfig(group, color);
1982
1983 // box border lines
1984 auto* line = d->borderLines.at(i);
1985 line->loadThemeConfig(group, color);
1986
1987 // median lines
1988 line = d->medianLines.at(i);
1989 line->loadThemeConfig(group, color);
1990 }
1991
1992 // whiskers
1993 d->whiskersLine->loadThemeConfig(group, themeColor);
1994 d->whiskersCapLine->loadThemeConfig(group, themeColor);
1995
1996 // symbols
1997 d->symbolMean->loadThemeConfig(group, themeColor);
1998 d->symbolMedian->loadThemeConfig(group, themeColor);
1999 d->symbolOutlier->loadThemeConfig(group, themeColor);
2000 d->symbolFarOut->loadThemeConfig(group, themeColor);
2001 d->symbolData->loadThemeConfig(group, themeColor);
2002
2003 // Tufte's theme goes beyond what we can implement when using the theme properties of XYCurve.
2004 // So, instead of introducing a dedicated section for BoxPlot, which would be a big overkill
2005 // for all other themes, we add here a special handling for "Tufte".
2006 if (plot->theme() == QLatin1String("Tufte")) {
2007 for (auto* background : d->backgrounds)
2008 background->setEnabled(false);
2009
2010 for (auto* line : d->borderLines)
2011 line->setStyle(Qt::NoPen);
2012
2013 for (auto* line : d->medianLines)
2014 line->setStyle(Qt::NoPen);
2015
2016 d->symbolMean->setStyle(Symbol::Style::NoSymbols);
2017 d->symbolMedian->setStyle(Symbol::Style::Circle);
2018 d->symbolOutlier->setStyle(Symbol::Style::NoSymbols);
2019 d->symbolFarOut->setStyle(Symbol::Style::NoSymbols);

Callers

nothing calls this directly

Calls 8

curveChildIndexMethod · 0.80
groupMethod · 0.45
themeColorPaletteMethod · 0.45
countMethod · 0.45
themeMethod · 0.45
setEnabledMethod · 0.45
setStyleMethod · 0.45

Tested by

no test coverage detected