SETTINGS
| 686 | //******************** SETTINGS ******************************* |
| 687 | //************************************************************* |
| 688 | void CartesianPlotLegendDock::load() { |
| 689 | // General-tab |
| 690 | |
| 691 | // Format |
| 692 | // we need to set the font size in points for KFontRequester |
| 693 | QFont font = m_legend->labelFont(); |
| 694 | font.setPointSizeF(std::round(Worksheet::convertFromSceneUnits(font.pointSizeF(), Worksheet::Unit::Point))); |
| 695 | ui.kfrLabelFont->setFont(font); |
| 696 | |
| 697 | ui.chkUsePlotColor->setChecked(m_legend->usePlotColor()); |
| 698 | usePlotColorChanged(ui.chkUsePlotColor->isChecked()); |
| 699 | ui.kcbLabelColor->setColor(m_legend->labelColor()); |
| 700 | bool columnMajor = m_legend->labelColumnMajor(); |
| 701 | if (columnMajor) |
| 702 | ui.cbOrder->setCurrentIndex(0); // column major |
| 703 | else |
| 704 | ui.cbOrder->setCurrentIndex(1); // row major |
| 705 | |
| 706 | ui.sbLineSymbolWidth->setValue(Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->lineSymbolWidth(), m_units), m_worksheetUnit)); |
| 707 | |
| 708 | // Geometry |
| 709 | |
| 710 | // widgets for positioning using absolute plot distances |
| 711 | ui.cbPositionX->setCurrentIndex((int)m_legend->position().horizontalPosition); |
| 712 | // positionXChanged(ui.cbPositionX->currentIndex()); |
| 713 | if (m_legend->position().horizontalPosition == WorksheetElement::HorizontalPosition::Relative) { |
| 714 | ui.sbPositionX->setValue(std::round(m_legend->position().point.x() * 100.)); |
| 715 | ui.sbPositionX->setSuffix(QStringLiteral(" %")); |
| 716 | } else |
| 717 | ui.sbPositionX->setValue(Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->position().point.x(), m_units), m_worksheetUnit)); |
| 718 | ui.cbPositionY->setCurrentIndex((int)m_legend->position().verticalPosition); |
| 719 | // positionYChanged(ui.cbPositionY->currentIndex()); |
| 720 | if (m_legend->position().verticalPosition == WorksheetElement::VerticalPosition::Relative) { |
| 721 | ui.sbPositionY->setValue(std::round(m_legend->position().point.y() * 100.)); |
| 722 | ui.sbPositionY->setSuffix(QStringLiteral(" %")); |
| 723 | } else |
| 724 | ui.sbPositionY->setValue(Worksheet::convertFromSceneUnits(roundSceneValue(m_legend->position().point.y(), m_units), m_worksheetUnit)); |
| 725 | |
| 726 | ui.cbHorizontalAlignment->setCurrentIndex((int)m_legend->horizontalAlignment()); |
| 727 | ui.cbVerticalAlignment->setCurrentIndex((int)m_legend->verticalAlignment()); |
| 728 | |
| 729 | // widgets for positioning using logical plot coordinates |
| 730 | bool allowLogicalCoordinates = (m_legend->plot() != nullptr); |
| 731 | ui.lBindLogicalPos->setVisible(allowLogicalCoordinates); |
| 732 | ui.chbBindLogicalPos->setVisible(allowLogicalCoordinates); |
| 733 | |
| 734 | if (allowLogicalCoordinates) { |
| 735 | const auto* plot = static_cast<const CartesianPlot*>(m_legend->plot()); |
| 736 | if (plot->xRangeFormatDefault() == RangeT::Format::Numeric) { |
| 737 | ui.lPositionXLogical->show(); |
| 738 | ui.sbPositionXLogical->show(); |
| 739 | ui.lPositionXLogicalDateTime->hide(); |
| 740 | ui.dtePositionXLogical->hide(); |
| 741 | |
| 742 | ui.sbPositionXLogical->setValue(m_legend->positionLogical().x()); |
| 743 | ui.sbPositionYLogical->setValue(m_legend->positionLogical().y()); |
| 744 | } else { // DateTime |
| 745 | ui.lPositionXLogical->hide(); |
no test coverage detected