| 3772 | } |
| 3773 | |
| 3774 | void MainWindow::restoreRightPanelState(const QDomElement& element) { |
| 3775 | if (element.isNull() || element.tagName() != QStringLiteral("right_panel_state")) { |
| 3776 | return; |
| 3777 | } |
| 3778 | |
| 3779 | // Panel visibility is intentionally not restored (see saveRightPanelState). |
| 3780 | |
| 3781 | // Curve Width: look up the button whose canonical value fuzzy-matches |
| 3782 | // the layout's stored value. Block group signals so the idClicked |
| 3783 | // lambda doesn't refresh the previews on this passive resync. |
| 3784 | if (element.hasAttribute(QStringLiteral("width")) && width_button_group_ != nullptr) { |
| 3785 | bool ok = false; |
| 3786 | const double wanted = element.attribute(QStringLiteral("width")).toDouble(&ok); |
| 3787 | if (ok) { |
| 3788 | for (int i = 0; i < static_cast<int>(kWidthButtonSpecs.size()); ++i) { |
| 3789 | if (qFuzzyCompare(kWidthButtonSpecs[i].second, wanted)) { |
| 3790 | checkGroupButton(width_button_group_, i); |
| 3791 | break; |
| 3792 | } |
| 3793 | } |
| 3794 | } |
| 3795 | } |
| 3796 | |
| 3797 | // Curve Style: checkedId is the CurveStyle enum value; pass through. |
| 3798 | // Same preview-refresh suppression via QSignalBlocker. |
| 3799 | if (element.hasAttribute(QStringLiteral("style")) && style_button_group_ != nullptr) { |
| 3800 | bool ok = false; |
| 3801 | const int wanted = element.attribute(QStringLiteral("style")).toInt(&ok); |
| 3802 | if (ok) { |
| 3803 | checkGroupButton(style_button_group_, wanted); |
| 3804 | } |
| 3805 | } |
| 3806 | |
| 3807 | // Splitter sizes: only apply when the parsed list length matches the |
| 3808 | // splitter's current widget count. A mismatch means the splitter shape |
| 3809 | // changed across PJ4 versions; layout silently skips this piece. |
| 3810 | if (element.hasAttribute(QStringLiteral("splitter_sizes")) && ui_->rightToolbarSplitter != nullptr) { |
| 3811 | const QStringList parts = |
| 3812 | element.attribute(QStringLiteral("splitter_sizes")).split(QLatin1Char(','), Qt::SkipEmptyParts); |
| 3813 | if (parts.size() == ui_->rightToolbarSplitter->count()) { |
| 3814 | QList<int> sizes; |
| 3815 | sizes.reserve(parts.size()); |
| 3816 | bool all_ok = true; |
| 3817 | for (const QString& p : parts) { |
| 3818 | bool ok = false; |
| 3819 | const int v = p.toInt(&ok); |
| 3820 | if (!ok) { |
| 3821 | all_ok = false; |
| 3822 | break; |
| 3823 | } |
| 3824 | sizes.push_back(v); |
| 3825 | } |
| 3826 | if (all_ok) { |
| 3827 | ui_->rightToolbarSplitter->setSizes(sizes); |
| 3828 | } |
| 3829 | } |
| 3830 | } |
| 3831 | } |