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

Method loadTheme

src/backend/worksheet/Worksheet.cpp:1916–1948  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1914// ######################### Theme management ##################################
1915// ##############################################################################
1916void Worksheet::loadTheme(const QString& theme) {
1917 Q_D(Worksheet);
1918 KConfigGroup group;
1919 KConfig* config = nullptr;
1920 if (!theme.isEmpty()) {
1921 // load values from the theme config
1922 config = new KConfig(ThemeHandler::themeFilePath(theme), KConfig::SimpleConfig);
1923
1924 // apply the same background color for Worksheet as for the CartesianPlot
1925 group = config->group(QStringLiteral("CartesianPlot"));
1926
1927 // load the theme for all the children
1928 const auto& children = this->children<WorksheetElement>(ChildIndexFlag::IncludeHidden);
1929 for (auto* child : children)
1930 child->loadThemeConfig(*config);
1931 } else {
1932 // load default values
1933 config = new KConfig();
1934 group = config->group(QStringLiteral("Worksheet"));
1935 }
1936
1937 // load background properties
1938 d->background->loadThemeConfig(group);
1939
1940 // load the theme for all the children
1941 const auto& children = this->children<WorksheetElement>(ChildIndexFlag::IncludeHidden);
1942 for (auto* child : children)
1943 child->loadThemeConfig(*config);
1944
1945 delete config;
1946
1947 Q_EMIT changed();
1948}

Callers

nothing calls this directly

Calls 3

isEmptyMethod · 0.45
groupMethod · 0.45
loadThemeConfigMethod · 0.45

Tested by

no test coverage detected