############################################################################## ######################### Theme management ################################## ##############################################################################
| 605 | // ######################### Theme management ################################## |
| 606 | // ############################################################################## |
| 607 | void 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 | } |
nothing calls this directly
no test coverage detected