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

Method loadThemeConfig

src/backend/worksheet/plots/cartesian/CartesianPlot.cpp:5543–5574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5541}
5542
5543void CartesianPlot::loadThemeConfig(const KConfig& config) {
5544 Q_D(CartesianPlot);
5545
5546 QString theme = QString();
5547 if (config.hasGroup(QStringLiteral("Theme"))) {
5548 theme = config.name();
5549
5550 // theme path is saved with UNIX dir separator
5551 theme = theme.right(theme.length() - theme.lastIndexOf(QLatin1Char('/')) - 1);
5552 DEBUG(Q_FUNC_INFO << ", set theme to " << STDSTRING(theme));
5553 }
5554
5555 // loadThemeConfig() can be called from
5556 // 1. CartesianPlot::setTheme() when the user changes the theme for the plot
5557 // 2. Worksheet::setTheme() -> Worksheet::loadTheme() when the user changes the theme for the worksheet
5558 // In the second case (i.e. when d->theme is not equal to theme yet),
5559 /// we need to put the new theme name on the undo-stack.
5560 if (theme != d->theme)
5561 exec(new CartesianPlotSetThemeCmd(d, theme, ki18n("%1: set theme")));
5562
5563 // load the color palettes for the curves
5564 this->setColorPalette(config);
5565
5566 // load the theme for all the children
5567 const auto& elements = children<WorksheetElement>(ChildIndexFlag::IncludeHidden);
5568 for (auto* child : elements)
5569 child->loadThemeConfig(config);
5570
5571 d->update(this->rect());
5572
5573 Q_EMIT changed();
5574}
5575
5576void CartesianPlot::saveTheme(KConfig& config) {
5577 const QVector<Axis*>& axisElements = children<Axis>(ChildIndexFlag::IncludeHidden);

Callers 1

childAddedMethod · 0.45

Calls 6

setColorPaletteMethod · 0.95
lengthMethod · 0.80
rectMethod · 0.80
QStringClass · 0.50
nameMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected