| 808 | } |
| 809 | |
| 810 | void CartesianPlotLegendDock::loadConfig(KConfig& config) { |
| 811 | KConfigGroup group = config.group(QStringLiteral("CartesianPlotLegend")); |
| 812 | |
| 813 | // General-tab |
| 814 | |
| 815 | // Format |
| 816 | // we need to set the font size in points for KFontRequester |
| 817 | QFont font = m_legend->labelFont(); |
| 818 | font.setPointSizeF(std::round(Worksheet::convertFromSceneUnits(font.pointSizeF(), Worksheet::Unit::Point))); |
| 819 | ui.kfrLabelFont->setFont(group.readEntry(QStringLiteral("LabelFont"), font)); |
| 820 | |
| 821 | ui.chkUsePlotColor->setChecked(group.readEntry(QStringLiteral("UsePlotColor"), m_legend->usePlotColor())); |
| 822 | usePlotColorChanged(ui.chkUsePlotColor->isChecked()); |
| 823 | ui.kcbLabelColor->setColor(group.readEntry(QStringLiteral("LabelColor"), m_legend->labelColor())); |
| 824 | |
| 825 | bool columnMajor = group.readEntry(QStringLiteral("LabelColumMajor"), m_legend->labelColumnMajor()); |
| 826 | if (columnMajor) |
| 827 | ui.cbOrder->setCurrentIndex(0); // column major |
| 828 | else |
| 829 | ui.cbOrder->setCurrentIndex(1); // row major |
| 830 | |
| 831 | ui.sbLineSymbolWidth->setValue( |
| 832 | roundValue(group.readEntry(QStringLiteral("LineSymbolWidth"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->lineSymbolWidth(), m_units), m_worksheetUnit)))); |
| 833 | |
| 834 | // Geometry |
| 835 | ui.cbPositionX->setCurrentIndex(group.readEntry(QStringLiteral("PositionX"), (int)m_legend->position().horizontalPosition)); |
| 836 | ui.sbPositionX->setValue( |
| 837 | Worksheet::convertFromSceneUnits(roundSceneValue(group.readEntry(QStringLiteral("PositionXValue"), m_legend->position().point.x()), m_units), m_worksheetUnit)); |
| 838 | ui.cbPositionY->setCurrentIndex(group.readEntry(QStringLiteral("PositionY"), (int)m_legend->position().verticalPosition)); |
| 839 | ui.sbPositionY->setValue( |
| 840 | Worksheet::convertFromSceneUnits(roundSceneValue(group.readEntry(QStringLiteral("PositionYValue"), m_legend->position().point.y()), m_units), m_worksheetUnit)); |
| 841 | ui.sbRotation->setValue(group.readEntry(QStringLiteral("Rotation"), std::round(m_legend->rotationAngle()))); |
| 842 | |
| 843 | ui.chkVisible->setChecked(group.readEntry(QStringLiteral("Visible"), m_legend->isVisible())); |
| 844 | |
| 845 | // Background-tab |
| 846 | backgroundWidget->loadConfig(group); |
| 847 | |
| 848 | // Border |
| 849 | borderLineWidget->loadConfig(group); |
| 850 | ui.sbBorderCornerRadius->setValue( |
| 851 | Worksheet::convertFromSceneUnits(roundSceneValue(group.readEntry(QStringLiteral("BorderCornerRadius"), m_legend->borderCornerRadius()), m_units), m_worksheetUnit)); |
| 852 | |
| 853 | // Layout |
| 854 | ui.sbLayoutTopMargin->setValue( |
| 855 | group.readEntry(QStringLiteral("LayoutTopMargin"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->layoutTopMargin(), m_units), m_worksheetUnit))); |
| 856 | ui.sbLayoutBottomMargin->setValue( |
| 857 | group.readEntry(QStringLiteral("LayoutBottomMargin"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->layoutBottomMargin(), m_units), m_worksheetUnit))); |
| 858 | ui.sbLayoutLeftMargin->setValue( |
| 859 | group.readEntry(QStringLiteral("LayoutLeftMargin"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->layoutLeftMargin(), m_units), m_worksheetUnit))); |
| 860 | ui.sbLayoutRightMargin->setValue( |
| 861 | group.readEntry(QStringLiteral("LayoutRightMargin"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->layoutRightMargin(), m_units), m_worksheetUnit))); |
| 862 | ui.sbLayoutHorizontalSpacing->setValue( |
| 863 | group.readEntry(QStringLiteral("LayoutHorizontalSpacing"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->layoutHorizontalSpacing(), m_units), m_worksheetUnit))); |
| 864 | ui.sbLayoutVerticalSpacing->setValue( |
| 865 | group.readEntry(QStringLiteral("LayoutVerticalSpacing"), Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->layoutVerticalSpacing(), m_units), m_worksheetUnit))); |
| 866 | ui.sbLayoutColumnCount->setValue(group.readEntry(QStringLiteral("LayoutColumnCount"), m_legend->layoutColumnCount())); |
| 867 |
no test coverage detected