############################################################################## ######################### Theme management ################################## ##############################################################################
| 1914 | // ######################### Theme management ################################## |
| 1915 | // ############################################################################## |
| 1916 | void 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 | } |
nothing calls this directly
no test coverage detected